MCPcopy Create free account
hub / github.com/dailydotdev/apps / onChange

Function onChange

packages/shared/src/contexts/PushNotificationContext.tsx:282–305  ·  view source on GitHub ↗
(permission)

Source from the content-addressed store, hash-verified

280 }
281
282 const onChange: ChangeEventHandler = (permission) => {
283 if (!permission) {
284 setIsSubscribed(false);
285 return;
286 }
287
288 if (
289 permissionChangeFailedRef.current ||
290 OneSignalCache.User.PushSubscription.optedIn
291 ) {
292 return;
293 }
294
295 optIn().catch((error: unknown) => {
296 permissionChangeFailedRef.current = true;
297 logEvent({
298 event_name: LogEvent.GlobalError,
299 extra: JSON.stringify({
300 origin: 'web_push_permission_change',
301 error: error instanceof Error ? error.message : 'unknown',
302 }),
303 });
304 });
305 };
306 const onSubscriptionChange: PushSubscriptionChangeHandler = ({
307 current,
308 }) => {

Callers

nothing calls this directly

Calls 1

logEventFunction · 0.85

Tested by

no test coverage detected