yields / data

attach data to elements. think $.data()
4 stars 2 forks source link

garbage collection #1

Open timoxley opened 11 years ago

timoxley commented 11 years ago

I haven't tested this yet, but I have a good feeling once an element is 'dataized' it can never be garbage collected. Storing the els in a WeakMap will solve this in ES6, but in the meantime, you may want to consider adding something like component/removed to .del the data+el reference automatically an element is removed from the dom.

This could be an optional setting, eg.

var api = data(el, {autoremove: true})
timoxley commented 11 years ago

Could be problematic if someone is doing temporary manipulation of the dom, e.g. removing elements to reorder them, so perhaps it could wait a few hundred milliseconds, if the item is not readded to the dom, then it'd remove the data.

yields commented 11 years ago

i actually don't use this component at all, i just use model and reactive.

i can transfer this repo to you or just add you to this repo.

timoxley commented 11 years ago

add me :D