Ali Zia
Ali Zia

Reputation: 3875

Can I call event listener after n seconds

I have a function

var inApp = cordova.InAppBrowser.open(ln, '_blank', 'location=no');
inApp.addEventListener('loadstop', function(){
    inApp.insertCSS({
        file: 'http://istudy.com.pk/api/hide.css'
    },onSuccess);
});

I want to insert the CSS after n seconds instead of loadstop. Is it possible? How can I achieve that?

Upvotes: 0

Views: 73

Answers (1)

Jameson the dog
Jameson the dog

Reputation: 1806

setTimout(function(){
   inApp.insertCSS({
       file: 'http://istudy.com.pk/api/hide.css'
   },onSuccess);
},3000) // 3000 milliseconds  = 3 seconds  

but this will only work if inApp is defined at time of execution

Upvotes: 2

Related Questions