|
| 1 | + |
| 2 | +<!DOCTYPE html> |
| 3 | +<html> |
| 4 | + |
| 5 | +<head> |
| 6 | + <title>MyPlugin</title> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 8 | + <style type="text/css"> |
| 9 | + </style> |
| 10 | +</head> |
| 11 | + |
| 12 | +<body> |
| 13 | + |
| 14 | +<div data-role="page" data-theme="a"> |
| 15 | + |
| 16 | + <div data-role="header" data-position="fixed"> |
| 17 | + <a href='#' class='ui-btn-left' data-icon='arrow-l' data-theme="c" onclick="history.back(); return false">Back</a> |
| 18 | + <h1>MyPlugin</h1> |
| 19 | + </div><!-- /header --> |
| 20 | + |
| 21 | + <div data-role="content"> |
| 22 | + |
| 23 | + <p> Todo: Documentation for MyPlugin</p> |
| 24 | + |
| 25 | + <p>In order to use MyPlugin, you must first load the plugin at the top of your script |
| 26 | + using the <b>LoadPlugin</b> method like this:</p> |
| 27 | + |
| 28 | + <div class="samp"> app.LoadPlugin( "MyPlugin" );</div> |
| 29 | + |
| 30 | + <p>Then you can create an instance of the plugin object when you need it like this:</p> |
| 31 | + |
| 32 | + <div class="samp"> plg = app.CreateObject( "MyPlugin" );</div> |
| 33 | + |
| 34 | + <br> |
| 35 | + <p>Examples:</p> |
| 36 | + |
| 37 | + <div data-role="collapsible" data-collapsed="true" data-mini="true" data-theme="a" data-content-theme="b"> |
| 38 | + <h3>Example - Get Version</h3> |
| 39 | + <div id="examp1" style="font-size:70%"> |
| 40 | + app.LoadPlugin( "MyPlugin" );<br> |
| 41 | + <br> |
| 42 | + function OnStart()<br> |
| 43 | + {<br> |
| 44 | + lay = app.CreateLayout( "Linear", "VCenter,FillXY" );<br><br> |
| 45 | + btn = app.CreateButton( "Press Me" );<br> |
| 46 | + btn.SetOnTouch( CallPlugin );<br> |
| 47 | + lay.AddChild( btn );<br><br> |
| 48 | + <b id="snip1" style="font-size:100%"> |
| 49 | + plg = app.CreateObject( "MyPlugin" );<br> |
| 50 | + </b><br> |
| 51 | + app.AddLayout( lay );<br> |
| 52 | + }<br> |
| 53 | + <br> |
| 54 | + function CallPlugin()<br> |
| 55 | + {<br> |
| 56 | + alert( plg.GetVersion() );<br> |
| 57 | + }<br><br> |
| 58 | + |
| 59 | + </div> |
| 60 | + <div name="divCopy" align="right"> |
| 61 | + <a href="#" data-role="button" data-mini="true" data-inline="true" onclick="copy(snip1)"> Copy </a> |
| 62 | + <a href="#" data-role="button" data-mini="true" data-inline="true" onclick="copy(examp1)">Copy All</a> |
| 63 | + <a href="#" data-role="button" data-mini="true" data-inline="true" onclick="demo(examp1)"> Run </a> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + |
| 67 | + |
| 68 | + <div data-role="collapsible" data-collapsed="true" data-mini="true" data-theme="a" data-content-theme="b"> |
| 69 | + <h3>Example - Test Callback</h3> |
| 70 | + <div id="examp2" style="font-size:70%"> |
| 71 | + app.LoadPlugin( "MyPlugin" );<br> |
| 72 | + <br> |
| 73 | + function OnStart()<br> |
| 74 | + {<br> |
| 75 | + lay = app.CreateLayout( "Linear", "VCenter,FillXY" );<br><br> |
| 76 | + btn = app.CreateButton( "Press Me" );<br> |
| 77 | + btn.SetOnTouch( CallPlugin );<br> |
| 78 | + lay.AddChild( btn );<br><br> |
| 79 | + <b id="snip2" style="font-size:100%"> |
| 80 | + plg = app.CreateObject( "MyPlugin" );<br> |
| 81 | + plg.SetOnMyReply( OnMyReply );<br> |
| 82 | + </b><br> |
| 83 | + app.AddLayout( lay );<br> |
| 84 | + }<br> |
| 85 | + <br> |
| 86 | + function CallPlugin()<br> |
| 87 | + {<br> |
| 88 | + plg.MyFunc( "hello", 21, true );<br> |
| 89 | + }<br><br> |
| 90 | + function OnMyReply( txt, num, bool )<br> |
| 91 | + {<br> |
| 92 | + alert( "txt=" + txt + " num=" + num + " bool=" + bool );<br> |
| 93 | + }<br> |
| 94 | + </div> |
| 95 | + <div name="divCopy" align="right"> |
| 96 | + <a href="#" data-role="button" data-mini="true" data-inline="true" onclick="copy(snip2)"> Copy </a> |
| 97 | + <a href="#" data-role="button" data-mini="true" data-inline="true" onclick="copy(examp2)">Copy All</a> |
| 98 | + <a href="#" data-role="button" data-mini="true" data-inline="true" onclick="demo(examp2)"> Run </a> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + |
| 102 | + </div><!-- /content --> |
| 103 | + |
| 104 | +</div><!-- /page --> |
| 105 | + |
| 106 | +</body> |
| 107 | +</html> |