Commit d5ac16c1 by Sebastián Katzer

Auto convert object to JSON

parent 14a06572
...@@ -132,6 +132,10 @@ exports.add = function (props, callback, scope) { ...@@ -132,6 +132,10 @@ exports.add = function (props, callback, scope) {
options.date = Math.round(options.date.getTime()/1000); options.date = Math.round(options.date.getTime()/1000);
} }
if (typeof options.json == 'object') {
options.json = JSON.stringify(options.json);
}
if (['WinCE', 'Win32NT'].indexOf(device.platform) > -1) { if (['WinCE', 'Win32NT'].indexOf(device.platform) > -1) {
fn = function (cmd) { fn = function (cmd) {
eval(cmd); eval(cmd);
...@@ -156,7 +160,7 @@ exports.add = function (props, callback, scope) { ...@@ -156,7 +160,7 @@ exports.add = function (props, callback, scope) {
exports.cancel = function (id, callback, scope) { exports.cancel = function (id, callback, scope) {
var fn = this.createCallbackFn(callback, scope); var fn = this.createCallbackFn(callback, scope);
exec(fn, null, 'LocalNotification', 'cancel', [id.toString()]); exec(fn, null, 'LocalNotification', 'cancel', [(id || '0').toString()]);
}; };
/** /**
...@@ -253,18 +257,18 @@ exports.hasPermission = function (callback, scope) { ...@@ -253,18 +257,18 @@ exports.hasPermission = function (callback, scope) {
}; };
/** /**
* Ask for permission to show notifications if not already granted. * Register permission to show notifications if not already granted.
* *
* @param {Function} callback * @param {Function} callback
* The function to be exec as the callback * The function to be exec as the callback
* @param {Object?} scope * @param {Object?} scope
* The callback function's scope * The callback function's scope
*/ */
exports.promptForPermission = function (callback, scope) { exports.registerPermission = function (callback, scope) {
if (device.platform != 'iOS') if (device.platform != 'iOS')
return; return;
exec(null, null, 'LocalNotification', 'promptForPermission', []); exec(null, null, 'LocalNotification', 'registerPermission', []);
}; };
/** /**
...@@ -389,4 +393,3 @@ exports.createCallbackFn = function (callbackFn, scope) { ...@@ -389,4 +393,3 @@ exports.createCallbackFn = function (callbackFn, scope) {
callbackFn.apply(scope || this, arguments); callbackFn.apply(scope || this, arguments);
}; };
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment