@Override protected void onDetach() { if (messageEventListeners != null) { for (final PostMessageEventListener messageEventListener : messageEventListeners) { final JavaScriptObject postMessageListenerFunction = postMessageListenerFunctions.remove(messageEventListener.getActionToWatch()); removeFrameNotificationListener(postMessageListenerFunction); } } super.onDetach(); }
@Override protected void onAttach() { if (messageEventListeners != null) { for (final PostMessageEventListener messageEventListener : messageEventListeners) { if (!postMessageListenerFunctions.containsKey(messageEventListener.getActionToWatch())) { postMessageListenerFunctions.put( messageEventListener.getActionToWatch(), addFrameNotificationListener(messageEventListener)); } } } super.onAttach(); }