Reputation: 4292
Working with Admob-free plugin.
How to fire interstitial close event,
//this is the code found for javscript
document.addEventListener('admob.interstitial.events.CLOSE', function (event) {
console.log(event)
admob.interstitial.prepare()
})
//i want this code in ionic3
can someone help how to do this in typescript/ ionic3
document.addEventListener is showing error in typescript
Upvotes: 1
Views: 747
Reputation: 1177
simply the best way to do it is simply as the below, but don't forget to register AdmobFree in the constructor
constructor(
private admobFree: AdMobFree,
public platform: Platform
) {
// Handle interstitial's close event
this.admobFree.on('admob.interstitial.events.CLOSE').subscribe(() => {
// handle interstitial close
});
}
Upvotes: 1
Reputation: 3451
import {Component, Renderer} from '@angular/core';
constructor(renderer: Renderer) {
renderer.listenGlobal('document', 'admob.interstitial.events.CLOSE', (event) => {
console.log(event);
});
}
you can do it like this
Upvotes: 2