Touch Develop retirement postponed until June 22, 2019. Sign-in and access to cloud assets to be removed on May 23, 2018.Learn More..

hosted apps

The hosted app scenario allows an application hosting a webview to expose a general javascript to interact with the TouchDevelop runtime.
This feature would allow a TouchDevelop script to send and receives messages from the application host.

calling the host from TouchDevelop scripts

if app → env → has host then
There's a host!
else ... end if
var res := app → host exec("start phone call")
  • register a handler for a callback that will be repeatedly called by the host
app → host subscribe("phone is ringing", handler)
where handler(text : String) is
hey someone is calling you!

supported host hooks

TouchDevelop will dynamically test for the following callbacks and use any available.
When this hook is used, TouchDevelop parses the request string as JSON to pass the arguments into the exec function.
service : string;
action: string;
parameters: any[];
  • touchDevelopExec, a custom javascript function to support TouchDevelop
function window.touchDevelopExec(req : string, cb : (res : string) => void);