> A tiddler object has an internal array "links". I would like to > understand the implications of manipulating this array. Can I sort it? > Remove non-existing links?
The 'links' array is automatically generated and updated by the core whenever a given tiddler is changed (see "Tiddler.prototype.changed" in the TW source). As a result, any manipulations you might make to the array will be overwritten each time the tiddler is changed. > Since I was not sure I ended up creating a copy of it in my macro > handler function: > var links = tiddler.getLinks().slice(0); Yup. That works nicely. > Another question is about Javascript: do I need to do anything to > discard of this copy at the end of the handler function? Am I > multiplying those copies every time the macro is invoked? Javascript automatically does 'garbage collection' on local variables. Because you used "var", the scope of your copied 'links' array is limited to the handler function in which it is defined. When that function ends, the array is gone. enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/TiddlyWikiDev?hl=en -~----------~----~----~----~------~----~------~--~---
