-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser-independent way of doing request animation frame. #2185
Comments
This comment was originally written by @bp74 I just ran into the same problem. My current project is porting a Flash game to Dart/HTML5 and if i can't use the "RequestAnimationFrame" cross browser it is really bad. Please address this issue soon. |
We need to add $dom_mozRequestAnimationFrame to dart:html or implement a generic scheme of providing multiple optional native bindings for a native method. void requestAnimationFrame(AnimationFrameCallback callback) "webkitRequestAnimationFrame,mozRequestAnimationFrame" { Which means use webkitRequestAnimationFrame or mozRequestAnimation frame if available Set owner to @rakudrama. |
This comment was originally written by @bp74 Thank you jacob, that sounds good. I have another suggestion: You could remove "webkitRequestAnimationFrame" and add the standard compliant "requestAnimationFrame" declaration. Now i add some JavaScript code (see below) to my page ... this should work right? I can't test it because the Dart2JS Compiler does not work with the latest builds of the Dart Editor :( <pre> I think Chrome AND Firefox (and IE 10) support "requestAnimationFrame" allready, right? |
Reference: 'A robust polyfill' at |
This comment was originally written by @bp74 Thank you very much, the latest build 6825 has got the new implementation, it works great! |
Added Fixed label. |
Revisions updated by `dart tools/rev_sdk_deps.dart`. lints (https://github.com/dart-lang/lints/compare/1e0245e..54cd7a0): 54cd7a0 2023-08-11 Parker Lougheed Cleanup docs and links (#142) protobuf (https://github.com/dart-lang/protobuf/compare/217c030..a852ba4): a852ba4 2023-08-14 Ömer Sinan Ağacan Release protobuf-3.1.0, protoc_plugin-21.1.0 (#868) 8505c58 2023-08-14 Ömer Sinan Ağacan Generate constructor arguments again, add a flag to disable (#855) test (https://github.com/dart-lang/test/compare/9b1828f..bc0a992): bc0a992d 2023-08-11 Nate Bosch Remove always null observatoryUrl for browsers (#2079) webdev (https://github.com/dart-lang/webdev/compare/f8f752c..19aad27): 19aad27b 2023-08-11 Elliott Brooks Reset DWDS to version 20.0.2-wip after release (#2193) 20cc6d3d 2023-08-10 Elliott Brooks Prepare DWDS for release to version 20.0.1 (#2192) 9e352670 2023-08-10 Elliott Brooks Prepare DWDS for release to version 20.0.0 (#2191) bc008840 2023-08-10 Bernardo Ferrari Update `file` dependency. (#2185) afbd6401 2023-08-10 Elliott Brooks Re-enable events_test with fix (#2189) 1f1efa35 2023-08-10 Elliott Brooks Fix Flutter crash by catching WipError on resume and mapping to RPC error (#2188) Change-Id: I159fc1b35b60bab9909f287a9c9f85b624993fb0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320640 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Auto-Submit: Devon Carew <devoncarew@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dart:html exposes webkitRequestAnimationFrame, but that means when compiled to JS it won't work in Firefox or IE. Ideally, it would just expose requestAnimationFrame() and the generated JS would detect and use the appropriate one:
requestID = window.mozRequestAnimationFrame(callback); // Firefox
window.msRequestAnimationFrame(callback); // IE 10 PP2+
window.webkitRequestAnimationFrame(callback[, element]); // Chrome/Webkit
The text was updated successfully, but these errors were encountered: