Effect CommunityEC
Effect Community3y ago
48 replies
Sadra

Issue with console.log not working once

why here console.log ONCE not working even once ?
Effect.tap(() => Effect.sync(() => console.log("ONCE")).pipe(Effect.once))


i used this but is there better solution ?
let firstTime = true;

Effect.promise(() => app()).pipe(
Effect.tap(() => Console.log("ONCE").pipe(Effect.when(() => firstTime))),
Effect.tap(() => Effect.sync(() => (firstTime = false))),
Effect.repeat(Schedule.spaced(3000)),
Effect.runPromise
);
Was this page helpful?