nope-js icon indicating copy to clipboard operation
nope-js copied to clipboard

Consider integrating with fastdom somehow

Open dglazkov opened this issue 9 years ago • 7 comments

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.

dglazkov avatar Apr 21 '15 04:04 dglazkov

nope-js looks like an interesting project, how is it supposed to be used?

wilsonpage avatar Apr 21 '15 17:04 wilsonpage

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:

  1. As an extension (on/off button), dynamically injected into the page -- to help with small-scale deployments or checking existing sites for badness.
  2. As a development-time check that you only don't use in production.

dglazkov avatar Apr 21 '15 19:04 dglazkov

Who is responsible for setting the lifeCycleMode?

wilsonpage avatar Apr 21 '15 20:04 wilsonpage

You still have to do that yourself, sadly. In your case, you'll flip it just before running the batch of "reads"

dglazkov avatar Apr 21 '15 20:04 dglazkov

Ah I get ya! So using nope-js would throw if user tried to do a 'read' in a 'write' callback?

wilsonpage avatar Apr 21 '15 21:04 wilsonpage

Yes. For example, currently, if you access element.offsetLeft in "write", nope will throw.

dglazkov avatar Apr 21 '15 21:04 dglazkov

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

dglazkov avatar Apr 21 '15 21:04 dglazkov