INNER CODE UNIT · TypeScript
initialize
OneSignal/react-native-onesignal · src/index.ts:108
export function initialize(appId: string) {
if (!isNativeModuleLoaded(RNOneSignal)) return;
RNOneSignal.initialize(appId);
void Promise.all([_addPermissionObserver(), _addPushSubscriptionObserver()]).catch((error) => {
console.warn('OneSignal: failed to read initial state', error);
});
}
/**
* If your integration is user-centric, or you want the ability to identify the user beyond the current device, the
* login method should be called to identify the user.
*/
export function login(externalId: string) {
if (!isNativeModuleLoaded(RNOneSignal)) return;
RNOneSignal.login(externalId);