How to access a property of the Event element in Javascript?

Asked

Viewed 65 times

1

I think it’s a silly question, but by my beginner knowledge I’m hitting myself a little. I am building an application in ionic3, this uses typescript, however the plugin I am working uses pure javascript. On my console I can display all "Event" properties, but how do I display a specific property ? The property I need is branded in yellow "rewardAmount".

Aqui está a imagem do meu console, o que preciso é deste destacado em amarelo

    videosAdColony() {
    let carregar = this.loading.create({content : "Carregando..."});
    carregar.present();
    let rewardConfig: AdMobFreeRewardVideoConfig = {
        isTesting: true,
        autoShow: true,
        id: 'ca-app-pub-8000726989219599/8229278077' //id videos AdColony
    };
    this.admob.rewardVideo.config(rewardConfig);
    this.admob.rewardVideo.prepare().then(() => {
        console.log('video adcolony executado com sucesso');
        carregar.dismissAll();
        document.addEventListener('admob.rewardvideo.events.REWARD', function (event) {

            console.log(event);
        })
    })
}
  • What returns in console.log(event.rewardAmount); and console.log(event.prototype.rewardAmount);?

  • It returns me a syntax error, and does not allow me to run the application for testing. In both commands

  • I was able to resolve it using: console.log(Event['rewardAmount']);

  • Enter your solution in the answer below ;)

1 answer

0

If it is an array: Event['fieldname']

If it is an object: Event.fieldName

If it is an object array: Event[0]. fieldName

Browser other questions tagged

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