error listen event can not be added and removed

4 views
Skip to first unread message

carrot...@gmail.com

unread,
Apr 21, 2014, 9:44:20 AM4/21/14
to ormma-di...@googlegroups.com
code is as below:
    var errorEnabled = false;
    function toggleErrorEnabled() {
       errorEnabled = !errorEnabled;

       if ( errorEnabled ) {

              mraid.addEventListener( 'error', handleErrorEvent );
       }
       else {
          // disable

              mraid.removeEventListener( 'error', handleErrorEvent );
       }

    }

call toggleErrorEnabled method twice to verify add error listen event and remove error listen event,however both of them do not work.
my code is wrong somewhere??

Nathan Carver

unread,
Apr 21, 2014, 9:50:11 AM4/21/14
to ormma-di...@googlegroups.com
Hi, your code seems appropriate. There could be a timing issue. You can also try simply mraid.removeEventListener('error') which is supposed to remove all event listeners for that event.

Thanks,
-Nathan



--
You received this message because you are subscribed to the Google Groups "ORMMA-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ormma-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

carrot...@gmail.com

unread,
Apr 21, 2014, 9:40:41 PM4/21/14
to ormma-di...@googlegroups.com
that is ok as you said,thank so much

在 2014年4月21日星期一UTC+8下午9时50分11秒,Nathan写道:
Reply all
Reply to author
Forward
0 new messages