I’m working on a TW plugin that uses some existing JS libraries. I want to understand plugin initialization order better:
- I have a plugin (
$:/plugins/peter/library
) that exposes a JS library as a TW plugin. I addedif ($tw.browser) { ... }
to the JS source to avoid initializing the plugin (which requireswindow
and friends) when running from node - I have another plugin (
$:/plugins/peter/something
) that has adependents
field set to `$:/plugins/peter/library - I add
console.log
statements to both plugins
I noticed that $:/plugins/peter/library
has its log statements run after $:/plugins/peter/library
. This is surprising - shouldn’t the “leaf-most” plugin get initialized first?