Skip to content

Commit cb4e412

Browse files
committed
chore(demo): clean up debug logging comments
1 parent f8819be commit cb4e412

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

examples/demo/src/hooks/useOneSignal.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ const RESOLVED_APP_ID = APP_ID?.trim() || DEFAULT_APP_ID;
1818
const apiService = OneSignalApiService.getInstance();
1919
const preferences = PreferencesService.getInstance();
2020

21+
// uncomment to debug ios logs in safari web inspector
22+
// const buf: string[] = [];
23+
// (['log', 'warn', 'error'] as const).forEach((level) => {
24+
// const orig = console[level].bind(console);
25+
// console[level] = (...args) => {
26+
// buf.push(`[${level}] ${args.map(String).join(' ')}`);
27+
// localStorage.setItem('__logs', JSON.stringify(buf.slice(-500)));
28+
// orig(...args);
29+
// };
30+
// });
31+
// then later call JSON.parse(localStorage.getItem('__logs')).forEach(l => console.log(l))
32+
2133
// One-shot SDK initialization at module-eval time. Capacitor's bridge queues
2234
// calls until native is ready, so no `deviceready` gating is required. The
2335
// downstream `OneSignal.initialize` short-circuits on the native side, but
@@ -261,11 +273,6 @@ export function useOneSignal(): UseOneSignalReturn {
261273
OneSignal.User.addEventListener('change', userChangeHandler);
262274

263275
const load = async () => {
264-
// Uncomment if you want so you have time to see logs while trying to open
265-
// safari web inspector. Not an issue for chrome web inspector.
266-
// await new Promise((resolve) => setTimeout(resolve, 10_000));
267-
// if (cancelled) return;
268-
269276
const [externalId, pushId, pushOptedIn, hasPerm, initialOnesignalId] = await Promise.all([
270277
OneSignal.User.getExternalId(),
271278
OneSignal.User.pushSubscription.getIdAsync(),

0 commit comments

Comments
 (0)