google / incremental-dom

An in-place DOM diffing library
http://google.github.io/incremental-dom/
Apache License 2.0
3.53k stars 178 forks source link

export getContext() #320

Open amieres opened 7 years ago

amieres commented 7 years ago

Hi I'm just starting with IncrementalDOM and so far I like it very much. I'm using it to replace React, since I ran into some limitations, like issues with WebComponents.

The one thing I needed to add is an export to a function to get the context, something like:

exports.getContext = () => context;

The reason I needed this is because I am injecting html into the innerHTML (similar to React's dangerouslySetInnerHTML) and needed to re-spawn some children elements every time the innerHtml changed. I was already processing notifications.nodesCreated and calling markCreated (although it wasn't a fully new node) seemed the most logical and convenient way to do it.

Just something to consider. Thank you and keep up the great work!

sparhami commented 7 years ago

The notifications API will soon be replaced by a helper function for watching for changes. I'll update this issue when I have more details!

amieres commented 7 years ago

great, I look forward to the improvements.