npm i --save nativescript-ddp-login
- 版本:1.2.0
- GitHub: https://github.com/triniwiz/nativescript-ddp-login
- NPM: https://npmjs.net.cn/package/nativescript-ddp-login
- 下载次数
- 昨天: 0
- 上周: 0
- 上个月: 0
## 安装
tns plugin add https://github.com/triniwiz/nativescript-ddp-client
tns plugin add nativescript-ddp-login
var DDPClient = require('nativescript-ddp-client');
var DDPLogin = require('nativescript-ddp-login');
var login = new DDPLogin();
var token = null;
// Resume login with valid token from previous login
login.loginWithToken(ddpClient, token,(err, userInfo)=>{
if (err) throw err;
token = userInfo.token;
});
// Login using a username
login.loginWithUsername(ddpClient, user, pass,(err, userInfo) =>{
if (err) throw err;
token = userInfo.token;
});
// Login using an email address
login.loginWithEmail(ddpClient, email, pass, (err, userInfo)=>{
if (err) throw err;
token = userInfo.token;
});
// Login using either a username or email address
login.loginWithAccount(ddpClient, userOrEmail, pass, (err, userInfo)=>{
if (err) throw err;
token = userInfo.token;
});