Hi Felix

> I need to register to window resize events to calculate the size of my
canvas as it's not possible with css without changing too much of TW.

> However, once my widget is destroyed, I cannot remove the eventlisteners
and next time the widget is created again, it creates another resize
listener.

It's a bad idea for a widget to add event listeners to the DOM (other than
to the dom elements that it creates). You'd be better off attaching your
event listener inside a startup module within the same plugin. You can use
closures or globals to communicate with your widget instances.

> Question: So is there a destructor that is called on my widget instance
in which I can remove the listeners I originally created at instantiation?

There is no destructor for widgets at the moment. I think we may well need
destructors to properly handle some memory leaks, but they've not been
required so far. I should explain that I'm not a huge fan of destructors in
JS because they have to be called manually.

Best wishes

Jeremy


On Sun, Nov 2, 2014 at 12:04 AM, Felix Küppers <[email protected]>
wrote:

> very creative! but I also doubt that resize events get propagated as
> iframes have their own dom.
>
> But I appreciate your idea BJ.
>
> Thanks
> Felix
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywikidev.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to