Add Event Listener for ThemableBrowser - Ionic 2


#1

Anyone know how to add event listener for cordova’s themeablebrowser plugin as i tried adding it but it returns me the error event listener does not exist for themeablebrowser.

openbrowser(url) {

let options = {
statusbar: {
    color: '#00000000'
},
toolbar: {
    height: 44,
    color: '#000000'
},
title: {
    color: '#ffffffff',
    showPageTitle: true
},
closeButton: {
    wwwImage: 'assets/img/close.png',
    align: 'left',
    event: 'closePressed'
},
customButtons: [
    {
        wwwImage: 'assets/img/share.png',
        align: 'right',
        event: 'sharePressed'
    }
],
}

//Error occurs here - property add eventlistener does not exist in ThemableBrowser

this.browser= new ThemeableBrowser(url,'_blank',options).addEventListener

}

#2

Did you resolve this? I am hitting the same wall…found it…

After declaring cordova below your import statements.

declare var cordova;


cordova.ThemeableBrowser.open(url,’_blank’,options).addEventListener…


#3

any solution? i have the same problem ! :confused:


#4

const browser: ThemeableBrowserObject = this.themeableBrowser.create(url, ‘_blank’, this.browserOption);
browser.on(‘exit’).subscribe(() => {
alert(‘exit’)
})
browser.on(‘closePressed’).subscribe(() => {
alert(‘closePressed’)
})