سؤال

Created an application with trigger.io using a two page design (more than one .html page) Working with push notifications now and have hit an issue using:

//forge.event.messagePushed.addListener(callback, error);
forge.event.messagePushed.addListener(
    function(push){
      alert(push);
    }, 
    function(error){
      alert(error);
    }
);

It works I get the push and it is outputted as an alert, but as soon as i change page the listener is triggered again and I get the same push outputted as an alert again.

Is there away to kill/destroy the the received and outputted push? Stopping it from showing again.

The only way I have found to stop it is to close and reopen the app.

By the way this is happening on iOS (not tested on android)

Trigger.io Push Docs

هل كانت مفيدة؟

المحلول

Short answer: Multi-page Trigger.io apps are going to give you weird and undefined results!

Long answer: If you want to use multiple html pages or external content within your app the best approach is to embed then in an iframe and communicate with the parent frame using HTML5 messaging:

http://dev.opera.com/articles/view/window-postmessage-messagechannel/
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top