nope-js
nope-js copied to clipboard
Consider integrating with fastdom somehow
The fastdom project does a very similar read/write distinction, maybe there's an opportunity to have a fastdom debug mode, where nope.js is used to throw when dumb things are happening.
@wilsonpage, you might find this interesting.
nope-js looks like an interesting project, how is it supposed to be used?
The main premise is that this library emphasizes bad ideas by throwing exceptions. It's sort of like a debug mode for your web app.
Currently, I have two ideas for deployment:
- As an extension (on/off button), dynamically injected into the page -- to help with small-scale deployments or checking existing sites for badness.
- As a development-time check that you only don't use in production.
Who is responsible for setting the lifeCycleMode?
You still have to do that yourself, sadly. In your case, you'll flip it just before running the batch of "reads"
Ah I get ya! So using nope-js would throw if user tried to do a 'read' in a 'write' callback?
Yes. For example, currently, if you access element.offsetLeft in "write", nope will throw.
I am currently compiling a list of layout triggers (DOM props/methods that will cause synchronous layout/reflow) for Blink here: https://github.com/dglazkov/nope-js/blob/master/nope.js#L12