Todo: Documentation for MyPlugin
In order to use MyPlugin, you must first load the plugin at the top of your script
using the LoadPlugin method like this:
app.LoadPlugin( "MyPlugin" );
Then you can create an instance of the plugin object when you need it like this:
plg = app.CreateMyPlugin();
Examples:
Example - Get Version
app.LoadPlugin( "MyPlugin" );
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
btn = app.CreateButton( "Press Me" );
btn.SetOnTouch( CallPlugin );
lay.AddChild( btn );
plg = app.CreateMyPlugin();
app.AddLayout( lay );
}
function CallPlugin()
{
alert( plg.GetVersion() );
}
Example - Test Callback
app.LoadPlugin( "MyPlugin" );
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
btn = app.CreateButton( "Press Me" );
btn.SetOnTouch( CallPlugin );
lay.AddChild( btn );
plg = app.CreateMyPlugin();
plg.SetOnMyReply( OnMyReply );
app.AddLayout( lay );
}
function CallPlugin()
{
plg.MyFunc( "hello", 21, true );
}
function OnMyReply( txt, num, bool )
{
alert( "txt=" + txt + " num=" + num + " bool=" + bool );
}