kylestetz / lissajous

:musical_note: A tool for programmatic audio performance in the browser using Javascript.

Home Page:http://lissajousjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add `track.delete`

kylestetz opened this issue · comments

A few references created automatically in the TimeSingleton prevent tracks from being garbage collected. These references should be removed through a track.delete method.

Things may get a bit complicated with any lingering in schedulers, but hopefully they are easy to dereference.

Also, groups need to be notified. This could be done through an event or through the TimeSingleton (if it held references to tracks and groups separately, which it should anyway).

There is no way to delete a track from within itself (only by referencing its parent object, e.g. delete window.t), so at least for now deleting a track will have to be a two-step operation.

The track needs to know about its impending destruction so that it can tell TimeSingleton to remove references to it. The API for now could either be:

var t = new track()
t.destroy(), delete window.t

or

var t = new track()
t.delete(), delete window.t

I am leaning toward the former since calling track.delete is misleading if it isn't actually deleted.

Closed with dca6752.