How to implement Cordova-plugin-accountkit in my Cordova project?

Asked

Viewed 150 times

0

I searched for examples but found nothing to clarify my doubt, I have no experience with Cordova (maybe that’s why I don’t know how to use the cordova-plugin-accountkit).

this is the file code index.js (practically 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 what my file should look like index.js and how to call it in the index.html

1 answer

0


  • Mark the answer as a solution to the problem... = D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.