-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
$mol_service moved to wires, better errors
- Loading branch information
Showing
9 changed files
with
237 additions
and
159 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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace $ { | ||
export class $mol_service_message_event extends $mol_object { | ||
data() { | ||
return null as null | Record<string, unknown> | ||
} | ||
|
||
result(result: {} | null) {} | ||
|
||
error(error: Error) {} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace $ { | ||
export class $mol_service_message_event_web extends $mol_service_message_event { | ||
event!: ExtendableMessageEvent | ||
|
||
override data() { | ||
const data = this.event.data as string | null | { | ||
[k: string]: unknown | ||
} | ||
if ( ! data || typeof data !== 'object' ) return null | ||
return data | ||
} | ||
|
||
@ $mol_action | ||
override result(result: {} | null) { | ||
this.event.ports[0].postMessage({ error: null, result }) | ||
} | ||
|
||
@ $mol_action | ||
override error(error: Error) { | ||
this.event.ports[0].postMessage({ error: error.toString(), result: null }) | ||
} | ||
} | ||
|
||
$.$mol_service_message_event = $mol_service_message_event_web | ||
} |
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,20 +1,20 @@ | ||
namespace $ { | ||
export class $mol_service_plugin extends $mol_object { | ||
static install() { return null as undefined | null | Promise<unknown> } | ||
static activate() { return null as undefined | null | Promise<unknown> } | ||
static message_data(data: {}) { return null as null | undefined | Promise<unknown> } | ||
static install() { return null as unknown } | ||
static activate() { return null as unknown } | ||
static message_data(data: {}) { return null as unknown } | ||
|
||
static service() { return this.$.$mol_service_worker } | ||
} | ||
|
||
export class $mol_service_plugin_cache extends $mol_service_plugin { | ||
static blocked(request: Request) { return false } | ||
static modify(request: Request, waitUntil: (promise: Promise<unknown>) => void) { | ||
return null as null | Response | PromiseLike<Response> | ||
return null as null | Response | ||
} | ||
} | ||
|
||
export class $mol_service_plugin_notify extends $mol_service_plugin { | ||
static notification(e: unknown) { return null as null | undefined | Promise<unknown> } | ||
static notification(e: unknown) { return null as unknown } | ||
} | ||
} |
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
Oops, something went wrong.