The short answer is that I now always use instanceProto.onCreateMy reasoning
As I understand it, anything in "instanceProto.onCreate
" will get run on a per instance creation basis. and so the creation of instance related stuffs should go there.
If you knew in advance that you'd only ever have one instance of your pluggin (e.g. the Keyboard plugin), in theory you could use the "pluginProto.Instance
" instead, ... but ...
If there's only ever going to be one instance, you can still use "instanceProto.onCreate
", and it will just get called once for your one instance. So "onCreate
" seems to work just fine regardless of the situation.
Also, I have now created single-instance-only plugins using both methods, and they both work, so I use "onCreate
" exclusively now. When I say "single-instance-only" I mean things like a math utility library, which you can literally only create a single instance of, again much like the Keyboard plugin. My modified SDK
Here is a download for my modified version of the plugin SDK, with additional comments and a more graphical style of dividing up the different sections of the runtime and edit files. I'm hoping to make a pluggin creation tutorial using this version of the SDK at some point, but in the meantime you're welcome to use it for pluggin making or just reference if it helps out in either respect.!fi_plugin_template.zipJS structure video
(youtube - 27 min)
The video is also a companion to a website that lets you type JS code and see a visual diagram representation of the inheritance structure as you go, and it uses exactly the same diagram system shown in the videos. JS real-time diagram Site
: http://www.objectplayground.com/ JS online sandbox
And finally, there's an online JS coding environment, that I use for testing functions and code snippets while working on pluggin projects, and it has been indispensable as a JS sandbox.
It's just nice to open a webpage and be instantly able to program anything, and have that code print anything out to a console.JS sandbox
Hope that helps out.