Forums > Javascript

something like onDelete() callback in JS?

December 24, 2011 | 5:54 am

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…


December 24, 2011 | 10:23 am

notifydeleted() ?

December 24, 2011 | 10:50 am

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.


January 6, 2012 | 1:44 pm

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.

Viewing 4 posts - 1 through 4 (of 4 total)