forked from thaarok/cordova-plugin-kiosk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kiosk.js
45 lines (36 loc) · 1.33 KB
/
kiosk.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
var exec = require('cordova/exec');
var KioskPlugin = {
exitKiosk: function () {
exec(function () {}, function (error) {
alert("KioskPlugin.exitKiosk failed: " + error);
}, "KioskPlugin", "exitKiosk", []);
},
isInKiosk: function (callback) {
if(/ios|iphone|ipod|ipad/i.test(navigator.userAgent)) {
callback(false); // ios not supported - cannot be in kiosk
return;
}
exec(function (out) {
callback(out == "true");
}, function (error) {
alert("KioskPlugin.isInKiosk failed: " + error);
}, "KioskPlugin", "isInKiosk", []);
},
isSetAsLauncher: function (callback) {
if(/ios|iphone|ipod|ipad/i.test(navigator.userAgent)) {
callback(false); // ios not supported - cannot be in kiosk
return;
}
exec(function (out) {
callback(out == "true");
}, function (error) {
alert("KioskPlugin.isSetAsLauncher failed: " + error);
}, "KioskPlugin", "isSetAsLauncher", []);
},
setAllowedKeys: function (keyCodes) {
exec(function () {}, function (error) {
alert("KioskPlugin.setAllowedKeys failed: " + error);
}, "KioskPlugin", "setAllowedKeys", keyCodes);
}
}
module.exports = KioskPlugin;