Server/WebView Requests
Client Enviroment
NOTE
There can be only one request and no more with the same name across all controllers.
Decorators
Name | Arguments | Description |
---|---|---|
@OnServerRequest() | name?: string | Listens to server requests and returns a value back to the server. |
@OnWebViewRequest() | id: string | number, name?: string | Listens to WebView requests and returns a value back to the webview. |
@OnServerRequest()
The OnServerRequest
decorator is used to listen to server requests and returns a value back to the server.
@Controller()
export class DeliciousMangoController {
@OnServer('eat')
public onEat() {
return 'Server said to the client that it ate a delicious mango!';
}
}
ts
@OnWebViewRequest()
The OnWebViewRequest
decorator is used to listen to WebView requests and return a value back to the WebView.
@Controller()
export class DeliciousMangoController {
@OnWebView('my_webview_id', 'eat')
public onFoo() {
return 'WebView said to the client that it ate a delicious mango!';
}
}
ts
On this page