typedef: type all of return value
This commit is contained in:
parent
5463685bd5
commit
b0d2d51dcb
63
gluon.d.ts
vendored
63
gluon.d.ts
vendored
@ -1,3 +1,64 @@
|
|||||||
|
type WindowApi = {
|
||||||
|
/**
|
||||||
|
* Evaluate a string or function in the web context.
|
||||||
|
* @returns Return value of expression given.
|
||||||
|
*/
|
||||||
|
eval: (
|
||||||
|
/** String or function to evaluate. */
|
||||||
|
expression: string|Function
|
||||||
|
) => Promise<any>
|
||||||
|
};
|
||||||
|
|
||||||
|
type IPCApi = {
|
||||||
|
/**
|
||||||
|
* Send an IPC event to the web context.
|
||||||
|
* @returns Replied event data (null by default).
|
||||||
|
*/
|
||||||
|
send(
|
||||||
|
/** Type of event to send. */
|
||||||
|
type: string,
|
||||||
|
|
||||||
|
/** Data of event to send. */
|
||||||
|
data: any
|
||||||
|
): Promise<any?>,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to IPC events of a specific type with a callback.
|
||||||
|
*/
|
||||||
|
on(
|
||||||
|
/** Type of event to handle. */
|
||||||
|
type: string,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ran whenever an IPC event of type specified is recieved. Should return optionally with what to reply with.
|
||||||
|
* @returns Optionally with what to reply with, otherwise null by default.
|
||||||
|
*/
|
||||||
|
callback: (data: any) => any
|
||||||
|
): void
|
||||||
|
};
|
||||||
|
|
||||||
|
type CDPApi = {
|
||||||
|
/**
|
||||||
|
* Send a CDP command to the browser.
|
||||||
|
* {@link https://chromedevtools.github.io/devtools-protocol/ Chrome DevTools Protocol Documentation}
|
||||||
|
* @returns Result of command from browser.
|
||||||
|
*/
|
||||||
|
send(
|
||||||
|
/** Method of CDP command. */
|
||||||
|
method: string,
|
||||||
|
|
||||||
|
/** Parameters of CDP command. */
|
||||||
|
params: Object?
|
||||||
|
): Promise<any>
|
||||||
|
};
|
||||||
|
|
||||||
|
type Window = {
|
||||||
|
window: WindowApi,
|
||||||
|
ipc: IPCApi,
|
||||||
|
cdp: CDPApi
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** A browser that Gluon supports. */
|
/** A browser that Gluon supports. */
|
||||||
type Browser = 'chrome'|'chrome_canary'|'chromium'|'edge'|'firefox'|'firefox_nightly';
|
type Browser = 'chrome'|'chrome_canary'|'chromium'|'edge'|'firefox'|'firefox_nightly';
|
||||||
|
|
||||||
@ -19,4 +80,4 @@ export function open(
|
|||||||
|
|
||||||
/** Additional options for opening. */
|
/** Additional options for opening. */
|
||||||
options: OpenOptions
|
options: OpenOptions
|
||||||
);
|
): Promise<Window>;
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
## December 2022 - January 2023
|
## December 2022 - January 2023
|
||||||
- [X] Total internal rewrite
|
- [X] Total internal rewrite
|
||||||
|
- [X] Type definitions
|
||||||
- [ ] "Hibernation" feasibility study
|
- [ ] "Hibernation" feasibility study
|
||||||
- [ ] Automated PR/commit CI testing
|
- [ ] Automated PR/commit CI testing
|
||||||
- [ ] System Tray API
|
- [ ] System Tray API
|
||||||
|
Loading…
x
Reference in New Issue
Block a user