-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpermissionScope.js
28 lines (21 loc) · 1.06 KB
/
permissionScope.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
'use strict';
var _exec = require('cordova/exec');
var _exec2 = _interopRequireDefault(_exec);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.init = function (config, success, error) {
(0, _exec2.default)(success, error, 'PermissionScope', 'initialize', [config]);
};
var types = ['Notifications', 'LocationInUse', 'LocationAlways', 'Contacts', 'Events', 'Microphone', 'Camera', 'Photos', 'Reminders', 'Bluetooth', 'Motion'];
types.forEach(function (type) {
var addPermissionMethod = 'add' + type + 'Permission';
var requestPermissionMethod = 'request' + type + 'Permission';
exports[addPermissionMethod] = function (message, success, error) {
(0, _exec2.default)(success, error, 'PermissionScope', 'addPermission', [type, message]);
};
exports[requestPermissionMethod] = function (success, error) {
(0, _exec2.default)(success, error, 'PermissionScope', 'requestPermission', [type]);
};
});
exports.show = function (success, error) {
(0, _exec2.default)(success, error, 'PermissionScope', 'show');
};