bmschmidt/quires

Better syntax for registering observers and callbacks

Closed this issue · 1 comments

I don't have my finger on it, but there's a better syntax for the IntersectionObserver example--which is a really fundamental one--than the thing I'm doing here.

For instance, it's possible that the <Document> component could export an object that, on demand, would gather up references to all the child components matching some criteria. This, though, would be a long road to go for something that is pretty much the same as native js document.querySelector.

One general solution would be to have a custom slot in settings that contains a list of functions which will be called on every component in the AST of signature function(data : NodeType, settings : PSCsettings, node : node) where node is primary DOM element for the node. (This can be accessed by binding in svelte: <div bind:this={node}/>. This would be quite nice.

If you wanted to use it on elements that don't have their own nodes (such as Space, LineBreak, and Str) things might get a little tricky--I guess you could just override the ones you wanted to be a <span>.