-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add setInfo command for electron webview handler (#105)
* feature: add setInfo command for electron webview handler * coverage * lint
- Loading branch information
Showing
6 changed files
with
37 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface Info { | ||
readonly webViewRoot: string | ||
readonly webViewId: string | ||
} |
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,17 @@ | ||
import type { Info } from '../Info.ts' | ||
|
||
interface State { | ||
[key: string]: Info | ||
} | ||
|
||
export const state: State = { | ||
infos: Object.create(null), | ||
} | ||
|
||
export const set = (webViewId: string, info: Info): void => { | ||
state[webViewId] = info | ||
} | ||
|
||
export const get = (webViewId: string): Info => { | ||
return state[webViewId] | ||
} |
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,10 @@ | ||
import * as CreateWebViewServerHandler from '../CreateWebViewServerHandler/CreateWebViewServerHandler.ts' | ||
import * as InfoRegistry from '../InfoRegistry/InfoRegistry.ts' | ||
import * as WebViewServerState from '../WebViewServerState/WebViewServerState.ts' | ||
|
||
export const setInfo = (id: number, webViewId: string, webViewRoot: string): void => { | ||
InfoRegistry.set(webViewId, { | ||
webViewId, | ||
webViewRoot, | ||
}) | ||
} |