-
-
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 push event handler added, sync scope
- Loading branch information
Showing
5 changed files
with
74 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
namespace $ { | ||
export class $mol_service_message_event extends $mol_object { | ||
readonly raw!: { | ||
data: unknown | ||
ports: readonly MessagePort[] | ||
} | ||
|
||
data() { | ||
return null as null | Record<string, unknown> | ||
const data = this.raw.data as string | null | { | ||
[k: string]: unknown | ||
} | ||
if ( ! data || typeof data !== 'object' ) return null | ||
return data | ||
} | ||
|
||
result(result: {} | null, errors?: readonly Error[]) {} | ||
@ $mol_action | ||
result(result: {} | null, errors?: readonly Error[]) { | ||
const error = errors?.length ? errors[0].toString() || errors[0].message : null | ||
this.raw.ports[0].postMessage({ error, result }) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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