something like onDelete() callback in JS?

Dec 24, 2011 at 5:54am

something like onDelete() callback in JS?

Hi guys,

I’m still primarily working in Max5, FYI.

I’ve run into a scenario where I’m occasionally creating objects in the global Javascript space (i.e. someObject = new Object();), and looking for a way to automatically delete them (since garbage collection will never do so in this case, I believe).

So, I’m wondering, is there an onDelete() type of callback that can be used when a [js] object gets deleted? Something like closebang, but called inside the object before the object gets deleted, providing a way to do some cleanup…

best,
Zachary

#44680
Dec 24, 2011 at 10:23am

notifydeleted() ?

#160798
Dec 24, 2011 at 10:50am

I only see notifydeleted() mentioned in one Java tutorial and can’t find any mention of it in the JavaScript documentation (Max5). But it works! Thanks Oli.

best,
Zachary

#160799
Jan 6, 2012 at 1:44pm

Thanks for mentioning it. We’ll have it documented. Basically the function notifydeleted is called before your js/jsui object disappear so you can do some cleaning. There’s some examples in the examples/jitter-examples/javascript folder.

#160800

You must be logged in to reply to this topic.