-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTorch.js
63 lines (47 loc) · 1.29 KB
/
Torch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Torch.js
// Cordova Plugin
//
//
// Created by Shazron Abdullah May 26th 2011
// Update by Lukas Beaton January 24, 2013
//
// This plugin was updated to work with iOS 6 and Cordova 2.3.0 (previously PhoneGap)
function Torch()
{
this._isOn = false;
var self = this;
this.__defineGetter__("isOn", function() { return self._isOn; });
}
Torch.prototype.turnOn = function(){
var fail = function() {}
if (typeof fail != "function") {
console.log("Torch.turnOn failure: failure parameter not a function")
return
}
var success = function() {}
if (typeof success != "function") {
console.log("Torch.turnOn success: failure parameter not a function")
return
}
cordova.exec(success, fail, "Torch", "turnOn", []);
};
Torch.prototype.turnOff = function(){
var fail = function() {}
if (typeof fail != "function") {
console.log("Torch.turnOff failure: failure parameter not a function")
return
}
var success = function() {}
if (typeof success != "function") {
console.log("Torch.turnOff success: failure parameter not a function")
return
}
cordova.exec(success, fail, "Torch", "turnOff", []);
};
Torch.install = function(){
if(!window.plugins) {
window.plugins = {};
}
window.plugins.torch = new Torch();
};
cordova.addConstructor(Torch.install);