chrisdickinson / raf Goto Github PK
View Code? Open in Web Editor NEWrequestAnimationFrame polyfill library
License: MIT License
requestAnimationFrame polyfill library
License: MIT License
My webapp blows up on Andorid 4.0 when I require raf
. Works fine everywhere else.
I just saw the package is updated to v3.4.1
, but I can't find any CHANGELOG to check out the changes.
Would you guys be so kind to provide us with a decent CHANGELOG please? ๐
Thanks for all your hard work! ๐
This my be considered an issue from perspective of someone who is not nodejs ninja and don't have intentions on using this polyfill in non-browser environment .
What should one do to have browser code built from this?
From what I can see&understand this is for node use.
I have cloned this version locally, and run npm install - which gave me performance-now
.
But still I don't get this.
I do care specifically about this polyfill since it is only one I could find that implements callback queueing - fantastic job.
Ty :)
I found your LICENSE
file at top of the repo. However, there is no LICENSE
file in the release tarball (under https://registry.npmjs.org/). There should be.
The tests aren't working on the latest version of node stable, 0.10.30:
$ npm test
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info pretest [email protected]
npm info test [email protected]
> [email protected] test /home/substack/projects/raf
> node test.js
TAP version 13
# continues to emit events
ok 1 time has passed: 32.195365
ok 2 time has passed: 48.86203166666667
ok 3 time has passed: 65.52869833333334
and it times out after that line.
Everything works fine on 0.10.29 and below.
Running in the browser with testling
works, but in node
, it hangs.
Since wzrd.in doesn't work (SSL certificate issue) it's impossible to import raf directly from CDN. It'd be nice to add UMD bundle to npm package, this way we can import lib from unpkg.com - example
This require require('raf/polyfill')
for less size.
Just a small feature request:
Add support for undefined global
namespace, if js-runtime environment is not a browser and not a nodejs.
// webpackBootstrap
require("raf");
org.graalvm.polyglot.PolyglotException: ReferenceError: global is not defined
at <js>.:program(webpack://ScalaJSBundlerLibrary/./node_modules/raf/index.js?:2)
var global = {};
// run webpack stuff:
require("raf");
// webpack import ok
Mostly useless.
Exception in thread "ScalaGraal-pool-1-thread-1" japgolly.scalagraal.ExprError$EvalError: ReferenceError: global is not defined
at japgolly.scalagraal.ExprError$InEval$.unapply(ExprError.scala:23)
at japgolly.scalagraal.Expr$.$anonfun$apply$2(Expr.scala:168)
at japgolly.scalagraal.Expr.$anonfun$$greater$greater$1(Expr.scala:144)
at japgolly.scalagraal.Expr.evalOrThrow(Expr.scala:25)
at japgolly.scalagraal.GraalContext$Builder.evalOrThrow$1(GraalContext.scala:131)
at japgolly.scalagraal.GraalContext$Builder.$anonfun$build$3(GraalContext.scala:134)
at japgolly.scalagraal.GraalContext$Builder.$anonfun$build$3$adapted(GraalContext.scala:134)
at scala.Option.foreach(Option.scala:437)
at japgolly.scalagraal.GraalContext$Builder.build(GraalContext.scala:134)
at japgolly.scalagraal.GraalContextPool$Builder$Fixed$Step2A.$anonfun$build$1(GraalContextPool.scala:84)
at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
at japgolly.scalagraal.GraalContextPool$Builder$Fixed$Step2B.$anonfun$build$2(GraalContextPool.scala:96)
at japgolly.scalagraal.GraalContextPool$DefaultContextThread$$anon$2.run(GraalContextPool.scala:164)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.graalvm.polyglot.PolyglotException: ReferenceError: global is not defined
at <js>.:program(webpack://ScalaJSBundlerLibrary/./node_modules/raf/index.js?:2)
at <js>../node_modules/raf/index.js(showcasessr-fastopt-library.js:4941)
at <js>.__webpack_require__(showcasessr-fastopt-library.js:5808)
at <js>.:program(webpack://ScalaJSBundlerLibrary/./node_modules/react-motion/lib/Motion.js?:31)
at <js>../node_modules/react-motion/lib/Motion.js(showcasessr-fastopt-library.js:5050)
at <js>.__webpack_require__(showcasessr-fastopt-library.js:5808)
at <js>.:program(webpack://ScalaJSBundlerLibrary/./node_modules/react-motion/lib/react-motion.js?:7)
at <js>../node_modules/react-motion/lib/react-motion.js(showcasessr-fastopt-library.js:5116)
at <js>.__webpack_require__(showcasessr-fastopt-library.js:5808)
at <js>.:anonymous(webpack://ScalaJSBundlerLibrary/./node_modules/react-stonecutter/lib/react-stonecutter.js?:1)
at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:379)
... 13 more
Exception in thread "ScalaGraal-pool-1-thread-2" japgolly.scalagraal.ExprError$EvalError: ReferenceError: global is not defined
at japgolly.scalagraal.ExprError$InEval$.unapply(ExprError.scala:23)
at japgolly.scalagraal.Expr$.$anonfun$apply$2(Expr.scala:168)
at japgolly.scalagraal.Expr.$anonfun$$greater$greater$1(Expr.scala:144)
at japgolly.scalagraal.Expr.evalOrThrow(Expr.scala:25)
at japgolly.scalagraal.GraalContext$Builder.evalOrThrow$1(GraalContext.scala:131)
at japgolly.scalagraal.GraalContext$Builder.$anonfun$build$3(GraalContext.scala:134)
at japgolly.scalagraal.GraalContext$Builder.$anonfun$build$3$adapted(GraalContext.scala:134)
at scala.Option.foreach(Option.scala:437)
at japgolly.scalagraal.GraalContext$Builder.build(GraalContext.scala:134)
at japgolly.scalagraal.GraalContextPool$Builder$Fixed$Step2A.$anonfun$build$1(GraalContextPool.scala:84)
at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
at japgolly.scalagraal.GraalContextPool$Builder$Fixed$Step2B.$anonfun$build$2(GraalContextPool.scala:96)
at japgolly.scalagraal.GraalContextPool$DefaultContextThread$$anon$2.run(GraalContextPool.scala:164)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.graalvm.polyglot.PolyglotException: ReferenceError: global is not defined
at <js>.:program(webpack://ScalaJSBundlerLibrary/./node_modules/raf/index.js?:2)
at <js>../node_modules/raf/index.js(showcasessr-fastopt-library.js:4941)
at <js>.__webpack_require__(showcasessr-fastopt-library.js:5808)
at <js>.:program(webpack://ScalaJSBundlerLibrary/./node_modules/react-motion/lib/Motion.js?:31)
at <js>../node_modules/react-motion/lib/Motion.js(showcasessr-fastopt-library.js:5050)
at <js>.__webpack_require__(showcasessr-fastopt-library.js:5808)
at <js>.:program(webpack://ScalaJSBundlerLibrary/./node_modules/react-motion/lib/react-motion.js?:7)
at <js>../node_modules/react-motion/lib/react-motion.js(showcasessr-fastopt-library.js:5116)
at <js>.__webpack_require__(showcasessr-fastopt-library.js:5808)
at <js>.:anonymous(webpack://ScalaJSBundlerLibrary/./node_modules/react-stonecutter/lib/react-stonecutter.js?:1)
at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:379)
... 13 more
Hi,
In your dependencies theres this performance-now package which has no Github page btw and wasn't touched since 4 years. This packages uses a deprecated coffee script version which is a security threat ( we were PEN tested recently and this came up there ).
To be honest this performance-now also doesn't looks okey, no Github page or any other, wasn't touched since years, etc.
Any chance for removing these in the future?
Add license header to dest files so that import
s implicitly import the license portion.
Hi!
I've been doing quite a bit of research around requestAnimationFrame (rAF) over the past few days in conjunction with a couple of pet projects. I went looking for a rAF polyfill in the form of a NPM module which could be used both in Node and in the browser (via browserify
). I was hoping that this module was the answer, but after a bit of trial and error I've come to a couple of realisations:
setTimeout/setImmediate
fallback is wrong. rAF is supposed to trigger 60 times a second (every 16.6ms), but your fallback triggers as fast as the system allows it. In Node on my Mac I got about 1k "FPS".My proposal:
raf
and raf-stream
(or similar). raf
will cover the polyfill part, delivering a near-as-possible spec version of rAF, to be used in the browser (via browserify
) and in Node. raf-stream
will use raf
and build a streaming interface on the top of it.raf
.If you think this sounds reasonable then I'm willing to put in the work to get it done.
setTimeout(cb, 0) simulates better because delay argument should be as small as to perform callback sooner, while a 10ms delay might skip 2 frame.
It seems like errors inside the raf handler are not really handled elegantly by Chrome.
require('raf')(function() {
var foo = undefined;
foo.bar()
})
Screen shot of debugger which breaks on errors. It doesn't give us any indication of where the error is actually coming from.
Using a normal requestAnimationFrame function works fine; Chrome can pinpoint the problem and break on it.
requestAnimationFrame(function() {
var foo = undefined;
foo.bar()
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.