-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIViewBinding.ts
More file actions
53 lines (52 loc) · 1.45 KB
/
IViewBinding.ts
File metadata and controls
53 lines (52 loc) · 1.45 KB
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
import {Card} from "../tokenScript/Card";
import {RequestFromView, ViewEvent} from "./ViewController";
import {RpcResponse} from "../wallet/IWalletAdapter";
/**
* IViewBinding is the interface the user-agent implements to provide a UI adapter than the engine uses to display TS cards
*/
export interface IViewBinding {
/**
* Render the HTML (or URL) associated with the view
* @param card
* @param tsId
*/
showTokenView(card: Card, tsId?: string): Promise<void>|void
/**
* Unload the current card from the token view
*/
unloadTokenView(): Promise<void>|void
/**
* Dispatch an event
* @param event
* @param data
* @param id
*/
dispatchViewEvent(event: ViewEvent, data: any, id: string|null): Promise<void>|void
/**
* Dispatch an event
* @param response RpcResponse
*/
dispatchRpcResult(response: RpcResponse): Promise<void>|void
/**
* Handle an engine request from the view
* @param event
* @param data
*/
handleMessageFromView(event: RequestFromView, data: any);
/**
* Inject platform specific Javascript code to interact with the engine from the TokenScript view
*/
getViewBindingJavascript(): string
/**
* Indicates that a new card has been set and the view is preparing to be loaded
*/
viewLoading(): Promise<void>|void
/**
* Indicate that an error has occurred while loading the view
*/
viewError(error: Error): Promise<void>|void
/**
* Show or hide loader
*/
showLoader(show?: boolean): Promise<void>|void
}