INNER CODE UNIT · TypeScript
optIn
OneSignal/react-native-onesignal · src/index.ts:400
export function optIn() {
if (!isNativeModuleLoaded(RNOneSignal)) return;
RNOneSignal.optIn();
}
}
/**
* Add a callback that fires when the OneSignal user state changes.
* Important: When using the observer to retrieve the onesignalId, check the externalId as well to confirm the values are associated with the expected user.
*/
export function addEventListener(
_event: 'change',
listener: (event: UserChangedState) => void,
) {
if (!isNativeModuleLoaded(RNOneSignal)) return;
isValidCallback(listener);