-
Notifications
You must be signed in to change notification settings - Fork 11
.ts 源文件
Lihao edited this page Jul 31, 2017
·
1 revision
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
* @name JPush
* @description
* This plugin does something
*
* @usage
* ```
* import { JPush } from 'ionic3-jpush';
*
* JPush.functionName('Hello', 123)
* .then((something: any) => doSomething(something))
* .catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
pluginName: 'JPush',
plugin: 'jpush-phonegap-plugin', // npm package name, example: cordova-plugin-camera
pluginRef: 'plugins.jPushPlugin', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/jpush/jpush-phonegap-plugin', // the github repository URL for the plugin
platforms: ['Android', 'iOS']
// install: '' // OPTIONAL install command, in case the plugin requires variables
})
export class JPush {
@Cordova()
init(): Promise<any> {
return; // We add return; here to avoid any IDE / Compiler errors
}
@Cordova()
stopPush(): Promise<any> {
return;
};
@Cordova()
resumePush(): Promise<any> {
return;
};
@Cordova()
isPushStopped(): Promise<any> {
return;
};
@Cordova()
getRegistrationID(): Promise<any> {
return;
};
@Cordova()
setTagsWithAlias(tags?: string[], alias?: string): Promise<any> {
return;
};
@Cordova()
setTags(tags?: string[]): Promise<any> {
return;
};
@Cordova()
setAlias(alias?: string): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
setBadge(badgeNum?: number): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
setApplicationIconBadgeNumber(badgeNum?: number): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
getApplicationIconBadgeNumber(): Promise<any> {
return;
};
@Cordova()
getUserNotificationSettings(): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
addLocalNotificationForIOS(option: LocalNotificationOption): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: String): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
clearAllLocalNotifications(): Promise<any> {
return;
};
@Cordova()
setLocation(latitude: String | Number, longitude: String | Number): Promise<any> {
return;
};
@Cordova()
isPlatformIOS(): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
addDismissActions(actions, categoryId: String): Promise<any> {
return;
};
@Cordova({
platforms: ['iOS']
})
addNotificationActions(actions, categoryId: String): Promise<any> {
return;
};
@Cordova({
eventObservable: true,
event: 'jpush.openNotification',
element: document
})
openNotification(): Observable<any> {
return;
};
@Cordova({
eventObservable: true,
event: 'jpush.receiveNotification',
element: document
})
receiveNotification(): Observable<any> {
return;
};
@Cordova({
eventObservable: true,
event: 'jpush.receiveMessage',
element: document
})
receiveMessage(): Observable<any> {
return;
};
}
export interface LocalNotificationOption {
delayTime: String | Number;
content: String;
badge: String | Number;
notificationID: String;
extras: Object;
}
export interface DismissActions {
title: String;
identifier: String;
option: String;
type?: String;
textInputButtonTitle?: String;
textInputPlaceholder?: String;
}