const picturesJob = yield* Effect
.tryPromise(() => {
if (client.pupPage) {
return client
.pupPage
?.screenshot({ path: `screenshot_${Date.now()}.png` })
.then(constVoid);
}
console.log('No pup page');
return Promise.resolve();
})
.pipe(
Effect.schedule(Schedule.spaced('1 second')),
Effect.forkScoped,
);
client.on('ready', () =>
Effect
.gen(function*() {
yield* Effect.log('Client is ready! open the latch');
yield* isLoggedIn.open;
yield* Fiber.interrupt(picturesJob).pipe(Effect.fork);
})
.pipe(Effect.runPromise));
const picturesJob = yield* Effect
.tryPromise(() => {
if (client.pupPage) {
return client
.pupPage
?.screenshot({ path: `screenshot_${Date.now()}.png` })
.then(constVoid);
}
console.log('No pup page');
return Promise.resolve();
})
.pipe(
Effect.schedule(Schedule.spaced('1 second')),
Effect.forkScoped,
);
client.on('ready', () =>
Effect
.gen(function*() {
yield* Effect.log('Client is ready! open the latch');
yield* isLoggedIn.open;
yield* Fiber.interrupt(picturesJob).pipe(Effect.fork);
})
.pipe(Effect.runPromise));