@erichlz/nativescript-pseudo-bubble-notification
这是一个 NativeScript 插件,仅在应用中生成伪气泡通知
npm i --save @erichlz/nativescript-pseudo-bubble-notification
- 版本:1.1.2
- GitHub: https://github.com/Erich2020/nativescript-pseudo-bubble-notification
- NPM: https://npmjs.net.cn/package/%40erichlz%2Fnativescript-pseudo-bubble-notification
- 下载量
- 昨日: 0
- 上周: 1
- 上月: 11
@erichlz/nativescript-pseudo-bubble-notification
ns plugin add @erichlz/nativescript-pseudo-bubble-notification
使用说明
此插件仅与 Angular 一起使用
import { PseudoBubbleNotification, ETYPE_INIT_POSITION, OptionsNotification } from '@erichlz/nativescript-pseudo-bubble-notification';
baseShowBubble(position, posName) {
PseudoBubbleNotification.showBubbleFloating({
image: '~/plugin-demos/hause.png',
onTap: () => {
console.log('on Tap Bubble: ', posName);
console.log('test pseudo-bubble-notification!');
},
position: position,
text:"1";
show:true;
}, {
text:"test message";
backgroundColor:"blue";
textColor:"white";
timeOpenShow:1000;
timeCloseShow:3000;
});
}
BubbleWhitSpecificPosition(){
PseudoBubbleNotification.showBubbleFloating({
image: '~/plugin-demos/hause.png',
onTap: () => {
console.log('on Tap Bubble: Specific Position');
console.log('test pseudo-bubble-notification!');
},
positionX: 100,
positionY: 140
});
}
BubbleWhitNotification(){
const options:OptionsNotification = {
channelId: 'Chanel01',
contentText: 'Body Content Notification',
titleNotification: 'Title',
notifyId: 111,
optionBubble: {
image: '~/plugin-demos/hause.png',
onTap: () => {
console.log('on Tap Bubble ');
console.log('test pseudo-bubble-notification!');
},
},
}
PseudoBubbleNotification.showNotification(options)
PseudoBubbleNotification.showNotification(options, {
text:"test message";
backgroundColor:"blue";
textColor:"white";
timeOpenShow:1000;
timeCloseShow:3000;
})
}
你可以使用的优先级如下
- 默认
- 低
- 最小
- 高
- 最大,它们位于 ETYPE_PRIORITY 枚举中
初始位置你可以使用如下
- 顶部居中,
- 顶部左,
- 顶部右,
- 中间居中,
- 中间左,
- 中间右,
- 底部居中,
- 底部左,
- 底部右,它们位于 ETYPE_INIT_POSITION 枚举中
interface OptionsBubble {
image: string;
onTap: Function;
colorClear?: string;
position?: ETYPE_INIT_POSITION;
positionY?: number;
positionX?: number;
}
interface OptionsNotification {
channelId: string;
contentText: string;
titleNotification: string;
notifyId: number;
priority?: ETYPE_PRIORITY;
autoCancel?: boolean;
colorSmallIcon?: number;
optionBubble: OptionsBubble;
}
export interface OptionsMessage{
text:string;
backgroundColor?:string;
textColor?:string;
timeOpenShow?:number;
timeCloseShow?:number;
}
export interface OptionLabel{
text:string;
show:boolean;
backgroundColor?:string;
color?:string;
}
许可证
Apache 许可证版本 2.0