typedef: add resources api
This commit is contained in:
parent
e250ea4853
commit
9e77f0a5b1
24
gluon.d.ts
vendored
24
gluon.d.ts
vendored
@ -435,6 +435,27 @@ type ControlsApi = {
|
|||||||
): Promise<void>
|
): Promise<void>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CSSResource = {
|
||||||
|
/** Remove the CSS previously added from the current page and future page loads. */
|
||||||
|
remove(): Promise<void>,
|
||||||
|
|
||||||
|
/** Update the CSS previously added to new code given in the current page and future page loads. */
|
||||||
|
modify(newCode: string): Promise<void>
|
||||||
|
};
|
||||||
|
|
||||||
|
type JSResource = {
|
||||||
|
/** Remove the JS previously added so it no longer executes in new page loads. */
|
||||||
|
remove(): Promise<void>
|
||||||
|
};
|
||||||
|
|
||||||
|
type ResourcesApi = {
|
||||||
|
/** Inject CSS to the current page and future page loads (refresh, navigations, etc). */
|
||||||
|
css(code: string): Promise<CSSResource>,
|
||||||
|
|
||||||
|
/** Inject JS to the current page and future page loads (refresh, navigations, etc). */
|
||||||
|
js(code: string): Promise<JSResource>
|
||||||
|
};
|
||||||
|
|
||||||
type Window = {
|
type Window = {
|
||||||
/** API for the page of the window. */
|
/** API for the page of the window. */
|
||||||
page: PageApi,
|
page: PageApi,
|
||||||
@ -445,6 +466,9 @@ type Window = {
|
|||||||
/** API for manually using CDP with the browser. */
|
/** API for manually using CDP with the browser. */
|
||||||
cdp: CDPApi,
|
cdp: CDPApi,
|
||||||
|
|
||||||
|
/** API for injecting resources like CSS and JS. */
|
||||||
|
resources: ResourcesApi,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API for Gluon idle management (like hibernation). Chromium only.
|
* API for Gluon idle management (like hibernation). Chromium only.
|
||||||
* @experimental
|
* @experimental
|
||||||
|
Loading…
x
Reference in New Issue
Block a user