npm i --save @triniwiz/nativescript-messenger
- 版本:1.0.0
- GitHub: https://github.com/triniwiz/nativescript-plugins
- NPM: https://npmjs.net.cn/package/%40triniwiz%2Fnativescript-messenger
- 下载
- 昨天: 0
- 上周: 0
- 上个月: 7
@triniwiz/nativescript-messenger
npm install @triniwiz/nativescript-messenger
使用方法
方法
send:向一个或多个接收者发送消息
参数
- numbers:电话号码字符串数组。支持单个或多个。可选
- message:消息正文。可选
- subject:主题消息。可选
- media:附件切换消息到 MMS,支持 png、jpeg、mp4 可选
import {send, available} from "@triniwiz/nativescript-messenger";
const numbers = ["868-657-1234", "868-630-4321", "868-648-1122"];
send(numbers, "My message", "Subject of Message", [
{
fileName: 'destiny_2.jpg',
mimeType: 'image/jpg',
path: '~/assets/destiny_2.jpg',
}
]);
此方法也返回一个 promise。可以使用以下方式在用户取消或发送消息后定义操作。
send(["868-555-5555", "868-555-4444"], "this is body").then(function(args){
console.log(args.response);
// either a string saying cancelled or sent
console.log(args.message);
// just a string with more detail than response.
/* you can do stuff here.. this happens back
in your app after the message window has
been dismissed */
}, function (e) {
console.log("Error occurred " + e);
// e will show a vague error message.
});
许可证
Apache 许可证第 2 版