make fgcommand.js a AMD module
This commit is contained in:
parent
5dcc0aa2ef
commit
1ff18c2cba
1 changed files with 90 additions and 66 deletions
|
@ -1,21 +1,34 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
var fgCommand = {
|
||||
(function(factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define([], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function(arg) {
|
||||
|
||||
fgCommand = {
|
||||
oneArg : function(t1, p1) {
|
||||
return {
|
||||
name : '',
|
||||
children : [ {
|
||||
children : [
|
||||
{
|
||||
name : t1,
|
||||
index : 0,
|
||||
value : p1
|
||||
} ]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
twoArgs : function(t1, p1, t2, p2) {
|
||||
return {
|
||||
name : '',
|
||||
children : [ {
|
||||
children : [
|
||||
{
|
||||
name : t1,
|
||||
index : 0,
|
||||
value : p1
|
||||
|
@ -23,7 +36,8 @@ var fgCommand = {
|
|||
name : t2,
|
||||
index : (t1 == t2 ? 1 : 0),
|
||||
value : p2
|
||||
} ]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -55,6 +69,14 @@ var fgCommand = {
|
|||
$.post("/run.cgi?value=pause");
|
||||
},
|
||||
|
||||
reset : function() {
|
||||
$.post("/run.cgi?value=reset");
|
||||
},
|
||||
|
||||
exit : function() {
|
||||
$.post("/run.cgi?value=exit");
|
||||
},
|
||||
|
||||
dialogShow : function(dlg) {
|
||||
this.sendCommand("dialog-show", this.oneArg("dialog-name", dlg));
|
||||
},
|
||||
|
@ -69,3 +91,5 @@ var fgCommand = {
|
|||
}
|
||||
};
|
||||
|
||||
return fgCommand;
|
||||
}));
|
||||
|
|
Loading…
Add table
Reference in a new issue