Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $ExpectError: check any
(event.userId: boolean);
});
OneSignal.addEventListener('inAppMessageClicked', event => {
(event.clickUrl: ?string);
(event.clickName: ?string);
(event.firstClick: boolean);
(event.closesMessage: boolean);
// $ExpectError: check any
(event.closesMessage: number);
});
OneSignal.removeEventListener('received', simpleHandler);
OneSignal.removeEventListener('opened', simpleHandler);
OneSignal.removeEventListener('ids', simpleHandler);
OneSignal.removeEventListener('emailSubscription', simpleHandler);
OneSignal.clearListeners();
});
(event.userId: boolean);
});
OneSignal.addEventListener('inAppMessageClicked', event => {
(event.clickUrl: ?string);
(event.clickName: ?string);
(event.firstClick: boolean);
(event.closesMessage: boolean);
// $ExpectError: check any
(event.closesMessage: number);
});
OneSignal.removeEventListener('received', simpleHandler);
OneSignal.removeEventListener('opened', simpleHandler);
OneSignal.removeEventListener('ids', simpleHandler);
OneSignal.removeEventListener('emailSubscription', simpleHandler);
OneSignal.clearListeners();
});
it("must call addEventListener and removeEventListener with supported event types", () => {
const simpleHandler = () => {};
OneSignal.addEventListener("received", simpleHandler);
OneSignal.addEventListener("opened", simpleHandler);
OneSignal.addEventListener("ids", simpleHandler);
OneSignal.addEventListener("emailSubscription", simpleHandler);
OneSignal.removeEventListener("received", simpleHandler);
OneSignal.removeEventListener("opened", simpleHandler);
OneSignal.removeEventListener("ids", simpleHandler);
OneSignal.removeEventListener("emailSubscription", simpleHandler);
OneSignal.clearListeners();
});
componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived)
OneSignal.removeEventListener('opened', this.onOpened)
OneSignal.removeEventListener('ids', this.onIds)
}
componentWillUnmount() {
OneSignal.removeEventListener('ids', this.onIds);
OneSignal.removeEventListener('registered', this.onPNRegistered);
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
this.unsubscribe();
this.unsubscribeCreate();
this.unsubscribeUpdate();
this.unsubscribeDelete();
}
return () => {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('ids', this.onIds);
};
}, []);
componentWillUnmount() {
OneSignal.removeEventListener('ids', this.onIds);
this.subscription.unsubscribe();
}
componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('ids', this.onIds);
}
return () => {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('ids', this.onIds);
};
}, []);