I searched for examples but found nothing to elucidate my doubt, I have no experience with cordova (maybe that's why I do not know how to use cordova-plugin-accountkit
).
This is the code for the file index.js
(pretty much the way it was downloaded):
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function() {
this.receivedEvent('deviceready');
},
// Update DOM on a Received Event
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
//código do account kit que eu não sei o que fazer com ele
loginWithPhoneNumber: function(options, onSuccess, onFailure) {
options = {
defaultCountryCode: "BR",
facebookNotificationsEnabled: true,
initialPhoneNumber: ["55", "123456789"]
};
function sucess(params){
console.log(params);
}
function failure(params){
console.log(params);
}
AccountKitPlugin.loginWithPhoneNumber(options, onSuccess, onFailure);
},
},
};
app.initialize();
I just wanted to know how my file index.js
should be and how to call it in index.html