|
1 |
| -/* |
2 |
| -Description: Firebase Command extension for DroidScript |
3 |
| -Author(s): D.Hurren, you? |
4 |
| -Copyright: droidscript.org |
5 |
| -License: Apache V2 |
6 |
| -*/ |
| 1 | +/** |
| 2 | + * @description |
| 3 | + * Commands.js File Recieves Command & Calls It By |
| 4 | + * Running Node Instance Of Our node_Firebase.js |
| 5 | + * File |
| 6 | + * |
| 7 | + * @authors |
| 8 | + * D. Hurren, O.Koore |
| 9 | + */ |
7 | 10 |
|
8 | 11 | //Make sure node sever is running.
|
9 |
| -function Init() { |
10 |
| - //Start menu server (with unique context id) on first show of 'Firebase' context menu. |
11 |
| - if (!glob[ext_progId]) { |
12 |
| - var dir = "/sdcard/DroidScript/Extensions/Firebase/Server"; |
13 |
| - ext_NodeRun( |
14 |
| - dir + "/node_Firebase.js", |
15 |
| - ext_progId, |
16 |
| - dir + "/node_modules", |
17 |
| - ); |
18 |
| - glob[ext_progId] = true; |
19 |
| - } |
| 12 | +function Init () { |
| 13 | + /** |
| 14 | + * Start menu server (with unique context id) |
| 15 | + * on first show of 'Firebase' context menu. |
| 16 | + */ |
| 17 | + if( !glob[ext_progId] ) { |
| 18 | + var dir = "/sdcard/DroidScript/Extensions/Firebase/Server" |
| 19 | + ext_NodeRun( dir+"/node_Firebase.js", ext_progId, dir + "/node_modules" ) |
| 20 | + glob[ext_progId] = true |
| 21 | + } else { ; } |
20 | 22 | }
|
21 | 23 |
|
22 |
| -//Called when using menus or wifi ide '!firebase' commands. |
23 |
| -function Firebase_OnCommand(cmd) { |
24 |
| - Init(); |
| 24 | +// Called when using menus or wifi ide '!firebase' commands. |
| 25 | +// Issue Why Does Wifi Ide Call firebase_OnCommand instead |
| 26 | +// of Firebase_OnCommand |
25 | 27 |
|
| 28 | +function Firebase_OnCommand( cmd ) { |
| 29 | + Init() |
| 30 | + |
26 | 31 | //Execute menu command in our node node_Firebase.js file.
|
27 |
| - ext_NodeExec(cmd.toLowerCase() + "()", ext_progId); |
| 32 | + ext_NodeExec( cmd.toLowerCase()+"()", ext_progId ) |
28 | 33 | }
|
29 | 34 |
|
30 |
| -//Called when 'Firebase' device context menu is selected. |
31 |
| -function Firebase_OnMenu() { |
32 |
| - Init(); |
| 35 | +function firebase_OnCommand( cmd ) { |
| 36 | + Init() |
| 37 | + |
| 38 | + ext_NodeExec( cmd.toLowerCase()+"()", ext_progId ) |
| 39 | +} |
33 | 40 |
|
34 |
| - //Show Firebase sub-menus. |
35 |
| - dlgFirebase = app.CreateListDialog("Firebase", "Serv,Deploy"); |
36 |
| - dlgFirebase.Show(); |
37 | 41 |
|
| 42 | +// Called when 'Firebase' device context menu is selected. |
| 43 | +function Firebase_OnMenu() { |
| 44 | + Init() |
| 45 | + |
| 46 | + //Show Firebase sub-menus. |
| 47 | + dlgFirebase = app.CreateListDialog( "Firebase", "Serv,Deploy" ) |
| 48 | + dlgFirebase.Show() |
| 49 | + |
38 | 50 | //Handle menu selection.
|
39 |
| - dlgFirebase.SetOnTouch((cmd) => { |
| 51 | + dlgFirebase.SetOnTouch( (cmd)=>{ |
| 52 | + |
40 | 53 | //Show fresh debug window.
|
41 |
| - app.ShowDebug(true, "dialog,clear"); |
| 54 | + app.ShowDebug( true, "dialog,clear" ) |
| 55 | + |
| 56 | + //Execute menu command in our node node_Firebase.js file. |
| 57 | + ext_NodeExec( cmd.toLowerCase()+"()", ext_progId ) |
| 58 | + }) |
| 59 | +} |
42 | 60 |
|
| 61 | +function firebase_OnMenu() { |
| 62 | + Init() |
| 63 | + |
| 64 | + //Show Firebase sub-menus. |
| 65 | + dlgFirebase = app.CreateListDialog( "Firebase", "Serv,Deploy" ) |
| 66 | + dlgFirebase.Show() |
| 67 | + |
| 68 | + //Handle menu selection. |
| 69 | + dlgFirebase.SetOnTouch( (cmd)=>{ |
| 70 | + |
| 71 | + //Show fresh debug window. |
| 72 | + app.ShowDebug( true, "dialog,clear" ) |
| 73 | + |
43 | 74 | //Execute menu command in our node node_Firebase.js file.
|
44 |
| - ext_NodeExec(cmd.toLowerCase() + "()", ext_progId); |
45 |
| - }); |
| 75 | + ext_NodeExec( cmd.toLowerCase()+"()", ext_progId ) |
| 76 | + }) |
46 | 77 | }
|
0 commit comments