generated from solidjs-community/solid-lib-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
123 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
import * as Schema from '@effect/schema/Schema' | ||
|
||
import * as Schema from "@effect/schema/Schema" | ||
export class InitialMessage extends Schema.TaggedRequest<InitialMessage>()('InitialMessage', { | ||
failure: Schema.Never, | ||
success: Schema.Void, | ||
payload: {}, | ||
}) {} | ||
|
||
export class InitialMessage extends Schema.TaggedRequest<InitialMessage>()( | ||
"InitialMessage", | ||
{ | ||
failure: Schema.Never, | ||
success: Schema.Void, | ||
payload: {} | ||
} | ||
) {} | ||
|
||
export class GetId extends Schema.TaggedRequest<GetId>()( | ||
"GetId", | ||
{ | ||
failure: Schema.Never, | ||
success: Schema.String, | ||
payload: { id: Schema.String }, | ||
} | ||
) {} | ||
export class GetId extends Schema.TaggedRequest<GetId>()('GetId', { | ||
failure: Schema.Never, | ||
success: Schema.String, | ||
payload: { id: Schema.String }, | ||
}) {} | ||
|
||
export const Requests = Schema.Union(InitialMessage, GetId) | ||
export type Requests = Schema.Schema.Type<typeof Requests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
/* eslint-disable require-yield */ | ||
import * as Runner from "@effect/platform/WorkerRunner" | ||
import * as BrowserRunner from "@effect/platform-browser/BrowserWorkerRunner" | ||
import { Requests } from "./schema" | ||
import { Effect, Layer } from "effect" | ||
import * as Runner from '@effect/platform/WorkerRunner' | ||
import * as BrowserRunner from '@effect/platform-browser/BrowserWorkerRunner' | ||
import { Requests } from './schema' | ||
import { Effect, Layer } from 'effect' | ||
|
||
Runner.layerSerialized(Requests, { | ||
InitialMessage: () => | ||
Effect.gen(function* () { | ||
console.log("Hello from worker") | ||
console.log('Hello from worker') | ||
}), | ||
GetId: ({ id }) => Effect.succeed(id).pipe(Effect.delay(1000)), | ||
}).pipe(Layer.provide(BrowserRunner.layer), Layer.launch, Effect.runPromise) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters