forked from sfc-gh-tkojima/vscode-react-webviews
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypings.d.ts
56 lines (50 loc) · 1.68 KB
/
typings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Type definitions for non-npm package vscode-webview 1.57
// Project: https://code.visualstudio.com/api/extension-guides/webview
// Definitions by: Matt Bierner <https://github.com/mjbvz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.0
/**
* API exposed to webviews.
*
* @template StateType Type of the persisted state stored for the webview.
*/
export interface WebviewApi<StateType> {
/**
* Post a message to the owner of the webview.
*
* @param message Data to post. Must be JSON serializable.
*/
postMessage(message: unknown): void;
/**
* Get the persistent state stored for this webview.
*
* @return The current state or `undefined` if no state has been set.
*/
getState(): StateType | undefined;
/**
* Set the persistent state stored for this webview.
*
* @param newState New persisted state. This must be a JSON serializable object. Can be retrieved
* using {@link getState}.
*
* @return The new state.
*/
setState<T extends StateType | undefined>(newState: T): T;
}
declare global {
declare module "*.ejs" {
const template = <T>(data: T): string => "";
export default template;
}
/**
* Acquire an instance of the webview API.
*
* This may only be called once in a webview's context. Attempting to call `acquireVsCodeApi` after it has already
* been called will throw an exception.
*
* @template StateType Type of the persisted state stored for the webview.
*/
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
function acquireVsCodeApi<StateType = unknown>(): WebviewApi<StateType>;
declare var __webpack_public_path__: string;
}