add features

This commit is contained in:
Lincoln
2013-10-21 11:28:42 +08:00
parent 83a491c7a4
commit 134d721aaf
2 changed files with 151 additions and 12 deletions
+43 -7
View File
@@ -1,7 +1,7 @@
var JPushPlugin = function(){
};
JPushPlugin.prototype.failure = function (msg) {
JPushPlugin.prototype.error_callback = function (msg) {
console.log("Javascript Callback Error: " + msg)
}
JPushPlugin.prototype.call_native = function (callback, name, args) {
@@ -9,35 +9,71 @@ JPushPlugin.prototype.call_native = function (callback, name, args) {
args = []
}
ret = cordova.exec(
callback, // called when signature capture is successful
this.failure, // called when signature capture encounters an error
'JPushPlugin', // Tell cordova that we want to run "JPushPlugin"
name, // Tell the plugin the action we want to perform
args); // List of arguments to the plugin
callback,
this.error_callback,
'JPushPlugin',
name,
args);
return ret;
}
JPushPlugin.prototype.setTags = function (tags, callback) {
this.call_native(callback, "setTags", [tags])
}
JPushPlugin.prototype.setAlias = function (alias, callback) {
this.call_native(callback, "setAlias", [alias])
}
JPushPlugin.prototype.pushCallback = function (data) {
var strArr = [data]
var str = strArr[0].message
document.getElementById('tarea').value=str
}
JPushPlugin.prototype.getIncoming = function (callback) {
this.call_native(callback, "getIncoming");
}
JPushPlugin.prototype.setBasicPushNotificationBuilder = function(callback){
this.call_native(callback,"setBasicPushNotificationBuilder");
}
JPushPlugin.prototype.setCustomPushNotificationBuilder = function(callback){
this.call_native(callback,"setCustomPushNotificationBuilder");
}
// Register the plugin
JPushPlugin.prototype.stopPush = function(callback){
this.call_native(callback,"stopPush");
}
JPushPlugin.prototype.resumePush = function(callback){
this.call_native(callback,"resumePush");
}
JPushPlugin.prototype.clearAllNoticication = function(callback){
this.call_native(callback,"clearAllNotification");
}
JPushPlugin.prototype.setLatestNotificationNum = function(num,callback){
this.call_native(callback,"setLatestNotificationNum",[num]);
}
JPushPlugin.prototype.isPushStopped = function(callback){
this.call_native(callback,"isPushStopped")
}
JPushPlugin.prototype.init = function(callback){
this.call_natvie(callback,"init");
}
JPushPlugin.prototype.setDebugable = function(mode,callback){
this.call_native(callback,"setDebugable",[mode]);
}
if(!window.plugins) {
window.plugins = {};
}