gdevelop-cordova-admob-plus
Version:
Trustable Google AdMob Cordova Plugin
26 lines (20 loc) • 552 B
text/typescript
type AdId = number
class AdMobState {
public applicationId: undefined | string
public devMode = false
public platform: string
public nextId: AdId = 100
public adUnits: { [key: string]: AdId } = {}
constructor() {
this.platform = typeof cordova !== 'undefined' ? cordova.platformId : ''
}
public getAdId(adUnitId: string) {
if (this.adUnits[adUnitId]) {
return this.adUnits[adUnitId]
}
this.adUnits[adUnitId] = this.nextId
this.nextId += 1
return this.adUnits[adUnitId]
}
}
export default AdMobState