-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
50 lines (40 loc) · 1.19 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict';
const Login = require('./lib/login');
const Session = require('./lib/session');
const Sleep = require('./lib/sleep');
const Methods = require('./lib/methods');
class FutJS extends Methods {
/**
* [constructor description]
* @param {String} options.email FUT E-mail
* @param {String} options.password FUT Password
* @param {String} options.secret FUT Secret answer
* @param {String} options.code FUT Backup code
* @param {String} options.platform FUT Platform [pc/ps3/ps4/xbox/xbox360]
*/
constructor(options) {
super();
let defaultOptions = {
minDelay : 0,
loginType : 'web'
};
this.options = {};
this.isReady = false; // instance will be ready after we call _init func
Object.assign(this.options, defaultOptions);
if (this.options.loginType === 'web') {
this.loginLib = new Login(options);
}
// TODO: implementation of mobile login (not safe to use)
}
async login() {
await this.loginLib.login();
super.init();
}
credits() {
return Session.load('userInfo')['credits'];
}
async sleep(ms) {
await Sleep(ms);
}
}
module.exports = FutJS;