diff --git a/browser/browser.ts b/browser/browser.ts index 478e1aa2..6c3d7c1f 100644 --- a/browser/browser.ts +++ b/browser/browser.ts @@ -35,6 +35,7 @@ module TDev { export var isWindows8plus = false; export var isCompiledApp = false; export var isWP8app = false; + export var isHosted = false; export var browser = BrowserSoftware.unknown; export var browserVersion = 0; export var browserVersion2 = 0; // not set for pinned iOS apps; look at webkitVersion instead @@ -113,6 +114,11 @@ module TDev { export function detect() { startTimestamp = new Date().getTime(); // no Util here + if ((window).touchDevelopExec || (window).mcefQuery) { + isHosted = true; + Browser.screenshots = true; + } + if ((window).isNodeJS) { isNodeJS = true isHeadless = true diff --git a/editor/editor.ts b/editor/editor.ts index a443ae95..1162cf93 100644 --- a/editor/editor.ts +++ b/editor/editor.ts @@ -191,9 +191,7 @@ module TDev public additionalFullScreenButtons(): HTMLElement[] { var btns = []; if (ScriptEditorWorldInfo.status == "published") - btns.push( - HTML.mkRoundButton("svg:camera,black", lf("screenshot"), Ticks.wallScreenshot, () => this.takeScreenshot()) - ); + btns.push(HTML.mkRoundButton("svg:camera,black", lf("screenshot"), Ticks.wallScreenshot, () => this.takeScreenshot())); return btns; } diff --git a/generated/help.cache b/generated/help.cache index c52eba00..e45379c7 100644 --- a/generated/help.cache +++ b/generated/help.cache @@ -15,9 +15,9 @@ "gmaec": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"social coding\";\nmeta rootId \"BW5Z2tT8PGR2YDIgrAuEFSwo\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// Understanding the script lifecycle in TouchDevelop #docs\n#VEa6LCnMw4ZByh2e\naction main() {\n #xBjWgS23MmRm2V8q // {parentTopic:contents}\n #TsSbdsjFrjlfbrl2 // {priority:18}\n #F3AeAVPtlABeBNH0 // TouchDevelop is a social coding platform where users can publish, fork, share their code freely.\n #NqBtxFlY9ixknwfz // ### script lifecycle\n #NNfJw34CNIpPxMKS // * [publishing scripts](/publishing)\n #D2ec4i8FUj8Zf42V // * [script udpates](/scriptupdates)\n #zatUDng4g32z2kw1 // * [script forks](/scriptforks)\n #worYh9j4YpqUkDjQ // * [pull requests](/pullrequests)\n #xBk0CTCjZwiUcwbn // * [](/groupscripts)\n #nTFmRh4k4iWbpFYt // * [how to search](/howtosearch)\n #hFLp36CMsiiqhnTC // ### community\n #WeNKI424s6V7W4kF // * [user score](/userscore)\n #t74MV1fKe6B4qWAO // * [user account](/useraccounts)\n #xAjOjHispoqafEHB // * [](/groups)\n #KKJEtnheKvaB9l3U // * [](/subscriptions)\n #ywJe2TIjeOzs8Qqn // * [](/insights)\n #EREwb2qLrQvylpAT // * [offline support](/offlinesupport)\n #HrlXZn0HuxSFDF8c // ### documentation\n #YCpaJ14DVX0dfFlw // * [add your own docs](/addyourowndocs)\n #xCtUVFwT2yTxkSyI // * [how to edit the docs](/howtoeditthedocs)\n}\n", "gnvi": "meta version \"v2.2,js,ctx\";\nmeta name \"theme\";\nmeta icon \"AlignLeft\";\nmeta color \"#ff9955bb\";\nmeta rootId \"pyxigTkgfxN2UU8WcngsVxr3\";\nmeta isLibrary \"yes\";\nmeta allowExport \"yes\";\nmeta platform \"current\";\n// Basic themes for boxes\naction title_1() {\n // Sets the current box to **title 1** style\n $m := 0.5;\n $font_size := 2;\n code→paragraph($m, $font_size, colors→foreground);\n}\naction paragraph(margins: Number, font_size: Number, foreground: Color) {\n box→set_margins($margins, $margins, $margins, $margins);\n box→set_font_size($font_size);\n box→set_text_wrapping(true, 15);\n box→set_foreground($foreground);\n if data→right_aligned then {\n box→set_horizontal_alignment(0, 1);\n }\n meta private;\n}\naction title_2() {\n // Sets the current box to **title 2** style\n $m := 0.5;\n $font_size := 1.5;\n code→paragraph($m, $font_size, colors→foreground);\n}\naction title_3() {\n // Sets the current box to **title 3** style.\n $m := 0.5;\n $font_size := 1.2;\n code→paragraph($m, $font_size, colors→foreground);\n}\naction subtle() {\n // Sets the current box to **subtle** style.\n $m := 0.5;\n $font_size := 1;\n code→paragraph($m, $font_size, colors→subtle);\n}\naction normal() {\n // Sets the current box to **normal** style\n $m := 0.5;\n $font_size := 1;\n code→paragraph($m, $font_size, colors→foreground);\n}\naction example() {\n if box→is_init then {\n skip;\n }\n if true then {\n // This library provides various built in themes to display structured paragraphs.\n // All text wrap by default.\n do box {\n code→huge;\n \"huge\" →post_to_wall;\n }\n do box {\n code→title_1;\n \"title 1\" →post_to_wall;\n }\n do box {\n code→title_2;\n \"title 2\" →post_to_wall;\n }\n do box {\n code→title_3;\n \"title 3\" →post_to_wall;\n }\n do box {\n code→normal;\n \"normal\" →post_to_wall;\n }\n do box {\n code→accent;\n \"accent\" →post_to_wall;\n }\n do box {\n code→subtle;\n \"subtle\" →post_to_wall;\n }\n }\n meta page;\n}\naction accent() {\n // Sets the current box to **accent** style.\n $m := 0.5;\n $font_size := 1;\n code→paragraph($m, $font_size, colors→accent);\n}\naction set_right_aligned(value: Boolean) {\n // Sets whether the next paragraphs should be right aligned.\n data→right_aligned := $value;\n}\nvar right_aligned : Boolean {\n}\naction huge() {\n // Sets the current box to **title 1** style\n $m := 0.5;\n $font_size := 5;\n code→paragraph($m, $font_size, colors→foreground);\n}\n", "gtfla": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync\";\nmeta name \"blank cordova library\";\nmeta icon \"ApproveButton\";\nmeta color \"#ffe3256b\";\nmeta rootId \"yGFW3wy9mcuwDt2lxN2XzLPS\";\nmeta isLibrary \"yes\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"accelerometer,compass,gyroscope,location,musicandsounds,network,orientation,phone,cordova\";\nmeta parentIds \"\";\n// A library that wraps an Apache cordova plugin #cordova\n#xbyRT3U8tTYlJuX3\naction init(#qC2ALk0kurvg43d9 options\\u003f: * Options) {\n #MNkyanFCYYm1mj2c // Initializes the plugin. Call once.\n #X4G0I6zR3PXSOoW2 contract→requires(data→logger→is_invalid, \"plugin already initialized\");\n #t7IXp9pyue4DKV3r app→import(\"cordova\", \"TODO: cordoval plugin name here\", \"*\");\n #pAoVhCYiE8wIBNx2 data→logger := app→create_logger(\"mylib\");\n #x5295YzyzYEkwRz9 // TODO: use `app-> javasctipt` and `app->javascript async` to proxy with javascript.\n #NSEi48Fc3E82Gzhc // TODO: change the script description\n #xGNJXaGae2QQzC4o // TODO: write docs in `code-> example`\n}\n#SHXfYJBDaSY28xmP\nvar logger : App_Logger {\n transient = true;\n}\n#BdGhpbmca\ntable Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n}\n#M64FUpLsIJLTUj44\naction example() {\n #HaX1MKDnbGBzPPnq // Document your library here!\n meta private;\n meta sync;\n}\n", +"gufle": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"blank creeper\";\nmeta color \"#ffffffff\";\nmeta rootId \"nHs55hVQebfHsdRXLqdn6Z3u\";\nmeta iconArtId \"yapqobto\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta splitScreen \"yes\";\nmeta platform \"accelerometer,location,musicandsounds,network,orientation,shell\";\nmeta parentIds \"\";\n// Move the creeper to create cool structures! #minecraft #turtle\n#ew46jSsSq5jX27bx\naction main() {\n #C5Nw6Q63PHrMOwzg @\\u267b→creeper→change_block(\"tnt\");\n #GntZkP8LuGenbICm for 0 ≤ i < 50 do {\n #PP9GM4o5xyjrF9bc @\\u267b→creeper→move_forward(5);\n #x17oHSx7q2zlZQpM @\\u267b→creeper→turn_left(90);\n }\n}\n#GkRCm24vdrBGjplt meta import creeper {\n pub \"orgh\"\n usage {\n action `async` move_forward(blocks: Number)\n action `async` turn_left(angle: Number)\n action `async` turn_right(angle: Number)\n action `async` move_back(blocks: Number)\n action `async` change_block(name: String)\n action `async` fly_down(blocks: Number)\n action `async` fly_up(blocks: Number)\n action `async` position() returns(x: Number, z: Number)\n action `async` fly_mode()\n action `async` build_cube(sides: Number)\n action `async` build_tower(sides: Number, height: Number)\n action `async` wipe_out()\n action `async` mine(blocks: Number)\n action `async` ground_height() returns(y: Number)\n action `async` walk_mode()\n action `async` dig_mode()\n action `async` block() returns(kind: String)\n action `async` chat(msg: String)\n action `async` add_checkpoint(id: String)\n action `async` go_to_checkpoint(id: String)\n action `async` build_walls()\n action `async` change_wool(c: Color)\n }\n #CIeQ22g72sWo4BjA resolve turtle = ♻ turtle with {\n }\n #mkTyjUBUvmVs1fii resolve minecraft_pi = ♻ minecraft_pi with {\n }\n #dv7qsUV5qDt2a9Wx resolve shell = ♻ shell with {\n }\n}\n#xuKTJPM232PU6f4b meta import turtle {\n pub \"wtmsc\"\n usage {\n type Maze\n action `async` pen_down()\n action `async` pen_up()\n action `async` move_to(x: Number, y: Number)\n action `async` forward(steps: Number)\n action `async` left_turn(angle: Number)\n action `async` set_pen_color(c: Color)\n action `async` xcor() returns(x: Number)\n action `async` ycor() returns(y: Number)\n action `async` heading() returns(a: Number)\n action `async` world_width() returns(w: Number)\n action `async` world_height() returns(h: Number)\n action `async` set_heading(angle: Number)\n action `async` set_pen_size(thickness: Number)\n action `async` right_turn(angle: Number)\n action `async` circle(radius: Number)\n action `async` world_board() returns(board: Board)\n action `async` turn_to(dx: Number, dy: Number)\n action `async` world_picture() returns(pic: Picture)\n action `async` set_speed(steps_per_second: Number)\n action `async` go_home()\n action `async` back(steps: Number)\n action `async` pen_size() returns(size: Number)\n action `async` clean()\n action `async` clear_screen()\n action `async` speed() returns(v: Number)\n action `async` set_xy(xcor: Number, ycor: Number)\n action `async` set_x(xcor: Number)\n action `async` set_y(ycor: Number)\n action `async` pen_color() returns(c: Color)\n action `async` color_under() returns(c: Color)\n action `async` save_picture()\n action `async` xy() returns(x: Number, y: Number)\n action `async` touch_xy() returns(tx: Number, ty: Number)\n action `async` show_grid()\n action `async` fast()\n action `async` stamp()\n action `async` set_turtle_picture(pic: Picture)\n action `async` set_turtle_opacity(opacity: Number)\n action `async` trail()\n action `async` add_obstacle(maze: ♻ turtle → Maze, x: Number, y: Number, width: Number, height: Number, c: Color)\n action `async` set_goal(maze: ♻ turtle → Maze, x: Number, y: Number, radius: Number, c: Color)\n action `async` maze() returns(maze: ♻ turtle → Maze)\n action `async` lock(maze: ♻ turtle → Maze)\n action `async` history() returns(commands: String)\n action `async` clear_history()\n action `sync` on_command(command: Text_Action)\n action `async` add_way_point(maze: ♻ turtle → Maze)\n action `async` on_collision(maze: ♻ turtle → Maze, collision: Action)\n action `async` interactive()\n action `async` on_move(@action: Action)\n action `async` set_raster(value: Boolean)\n }\n}\n#QEt4sOXtD66hd5sC meta import minecraft_pi {\n pub \"qeipe\"\n usage {\n action `async` `type` Block_Event_Action(hit: ♻ minecraft_pi → Block_Event)\n #BVGhpbmca\n table Block_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xNQF2IfWS5kUTCuC state : Number\n // Specifies the color or the id of the whool\n #xUNtn4WzFNh0J275 wool : String\n }\n }\n #xIIDIryL3GdLzzFH\n table Connect_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #IhKVKMjdA949jNr3 host : String\n #PQgsvjixlAlu49Bw port : Number\n #nlMXsJlluWZB1fNN proxy : String\n }\n }\n #umgRs0Idq3y9jRyc\n table Block_Event {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #SCV1txxxrjigP8XC kind : String\n #UIy6UFvY6WJWDDoA x : Number\n #wWASeEjKJDoiqrL2 y : Number\n #MkoIqcTcP3QiIoot z : Number\n #kYCW4sVB0Q5jQy0Q face : Number\n #EayHvTpmMjNF3Sfh entity : ♻ minecraft_pi → Entity\n }\n }\n #pqaWOjEWNqEkbxwJ\n table Position {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #L4NO4JXo2Sev2b1J x : Number\n #x2UU2Lt4BiV8NNNz y : Number\n #gw4VDwinZ6yVcwzL z : Number\n }\n }\n #eVDb6TwJ7CKitS8g\n table Repeat_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Delay in seconds between execution\n #VB0iDf9EazabCCQM delay : Number\n }\n }\n type Entity\n action `async` connect(options\\u003f: ♻ minecraft_pi → Connect_Options)\n action `async` set_block(x: Number, y: Number, z: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` set_many_blocks(x: Number, y: Number, z: Number, x2: Number, y2: Number, z2: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` block(x: Number, y: Number, z: Number) returns(name: String)\n action `async` height(x: Number, z: Number) returns(h: Number)\n action `async` chat(msg: String)\n action `async` position(entity: ♻ minecraft_pi → Entity) returns(pos: ♻ minecraft_pi → Position)\n action `async` set_position(entity: ♻ minecraft_pi → Entity, x: Number, y: Number, z: Number)\n action `async` test_commands()\n action `sync` is_connected() returns(r: Boolean)\n action `async` player_() returns(p: ♻ minecraft_pi → Entity)\n action `async` direction(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` rotation(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` pitch(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` player_by_name(name: String) returns(steve: ♻ minecraft_pi → Entity)\n action `sync` block_names() returns(names: Collection[String])\n action `async` repeat(@action: Action, options\\u003f: ♻ minecraft_pi → Repeat_Options) returns(t: Timer)\n action `sync` wool_colors() returns(cs: Collection[Color])\n action `sync` wool_color(c: Color) returns(name: String)\n action `async` on_hit(@action: ♻ minecraft_pi → Block_Event_Action)\n action `async` spawn(kind: String, x: Number, y: Number, z: Number) returns(mob: ♻ minecraft_pi → Entity)\n action `async` test_spawn()\n }\n #Q7G83JiIQxiwxcZi resolve shell = ♻ shell with {\n }\n}\n#xrf8yyBo7axaAgOD meta import shell {\n pub \"qmzn\"\n usage {\n #BdGhpbmca\n table Exec_Output {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #YaaLgMz45N5ZuAeU success : Boolean\n #qrwQiGIhHhUhb8AF error : String\n #ijyQCE4KPQL2ziZD code : Number\n #wf4AkGfhLyWkyKhQ stdout : String\n #ZyLfqXXM99R1znCa stderr : String\n }\n }\n #ttC12C2SJrh1ODjl\n table Serial_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #wXa4BRcG6mdxKU25 delimiter : String\n }\n }\n type Command_Result\n type Shell_Socket\n action `async` write_file(path: String, content: String) returns(res: ♻ shell → Command_Result)\n action `sync` mkpath(folder: String, name: String) returns(path: String)\n action `async` mkdir(path: String) returns(res: ♻ shell → Command_Result)\n action `async` exec(cmd: String, cwd: String) returns(res: ♻ shell → Exec_Output)\n action `sync` logger() returns(logger: App_Logger)\n action `async` exec_file(cmd: String, args: Collection[String], cwd: String) returns(res: ♻ shell → Exec_Output)\n action `async` python_env() returns(res: ♻ shell → Command_Result)\n action `async` tcp_connect(host: String, port: Number) returns(sock: ♻ shell → Shell_Socket)\n action `async` receive(sock: ♻ shell → Shell_Socket) returns(netdata: String)\n action `async` send(sock: ♻ shell → Shell_Socket, netdata: String)\n action `async` close(sock: ♻ shell → Shell_Socket)\n action `async` serialport_connect(name: String, options\\u003f: ♻ shell → Serial_Options) returns(sock: ♻ shell → Shell_Socket)\n action `async` serial_list() returns(ports: Json_Object)\n }\n}\n", "ibksb": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync\";\nmeta name \"blank node library\";\nmeta icon \"ArrowStandardCircle\";\nmeta color \"#ff007fff\";\nmeta rootId \"yGFW3wy9mcuwDt2lxN2XzLPS\";\nmeta isLibrary \"yes\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"network,npm,shell\";\nmeta parentIds \"\";\n// A library that wraps a npm module #node #npm #azure\n#xbyRT3U8tTYlJuX3\naction init(#qC2ALk0kurvg43d9 options\\u003f: * Options) {\n #MNkyanFCYYm1mj2c // Initializes the library. Call this action from your ``_init`` function.\n #t7IXp9pyue4DKV3r app→import(\"npm\", \"TODO: npm package name here\", \"*\");\n #pAoVhCYiE8wIBNx2 data→logger := app→create_logger(\"TODO: mylib\");\n #PUrP48D9R04LP8ev // TODO: use `app-> server setting` to read environment variables or node command line arguments.\n #x5295YzyzYEkwRz9 // TODO: use `app-> javasctipt` and `app->javascript async` to proxy with javascript.\n #fNRnVruS6cg7D9H3 // TODO: write some unit tests!\n #xlb7m4Eyw0BWFbzP // TODO: change the script description\n #s4LqDBpWVhF4APDU // TODO: write the docs in `code-> example`\n}\n#SHXfYJBDaSY28xmP\nvar logger : App_Logger {\n transient = true;\n}\n#BdGhpbmca\ntable Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n}\n#egka9cxvzrsZcSyc\naction example() {\n #xbnNQHjvSDNjeKCB // Document your library here!\n #CHb8jtuTrMd1PuMI // {imports}\n meta private;\n meta sync;\n}\n", "iurla": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"what\\'s new?\";\nmeta rootId \"oGIahryiInwIpsu2H7pX84CQ\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// release notes #docs\n#gMH7AtpXfxA2FZuYuc70zvTg\naction main() {\n #KN6Hyh4R0VdJdW12 // {parentTopic:contents}\n #C4J9deHXvt4lAMtW // {priority:1}\n #xNGLl7UVKMsrfBtR // {hide}\n #hdiFhuPgtoIAxNMU $board := media→create_landscape_board(800, 480);\n #YFcbdAvVWgJIYuA2 $pic := media→create_picture(480, 800);\n #xHyoPiwr1eIqHsx8 $thing := records→thing_table→add_row;\n #KTDbHXA9o6IYn06Y // {/hide}\n #Gm1rJgBBb7mfxnas // * **Join the [TouchDevelop Updates group](#pub:evjjxsjs)** to be notified about upcoming features and releases.\n #q1OyHlYqW8XFO7uC // ## February\n #bLGyRe88cWcUwPM3 // * deprecated crowd source run and coverage maps collection.\n #NSnGZHMZvQDX4awK // ### January\n #v3L9m2jXHjGCLbDw // * switched the app generation to App Studio and Cordova\n #ZFUQ9GsEs5SSkbgs // * button plugins can load buttons in the editor\n #tS9RO2F48DYHv6bV // * set a wallpaper in the hub!\n #kiA1lM0tw2WGGYET // * set an **icon** and **splash** picture art resource on scripts. The icon is displayed on all searches.\n #Vlmnwr0jCxc0bCty // * support for Python **pip** in ``app->import``. TouchDevelop creates a Python virtual environment and install the required pip packages.\n #wZ2rVQ3FOGZWfEdD // ### December 2014\n #x5oG13lAF6NZyDli // * [group scripts](/groupscripts) allow multiple users to collaborate on a single script\n #PVabV6GQFdt4XBag // * `app->import` allows to import **Node.JS npm** or **Apache Cordova plugins**.\n #wiTYksRN9Hv2iVnq app→import(\"npm\", \"azure-storage\", \"*\");\n #HA4q6o3aE7Cyz6tE // * script [plugins](/plugins) can have button inserted in the script editor\n #qV0pfa992reHW5Hv // * new [arduino tutorials](/arduinotutorials)\n #xJUEp8q1O2PUK74X // {pic:arduino blink:4x4}\n #pZ3uWaouxVtg7RPO // ### November 2014\n #YjF6a4nYSKYHJSXX // * An awesome new tutorial with super-cool videos that explain every step!\n #jSFgLhHY5aFFw6e0 // {follow:Coding Jetpack Jumper!}\n #sLrTw2l2DAXtP4qI // * **beta only:** real time multi user editing of [group scripts](/group scripts)!!!\n #pVVkVwNlJE44ZhD2 // * **beta only:** different editor modes for different users: try the **block mode** and **pro mode**\n #KKYOD6Rx6EWIgrDZ // {pic:block mode:7x7}\n #VnMmHhxgba8g0XJc // {pic:pro mode:7x7}\n #xJCceQUmsB4YdCsp // * new api `app->restart` let's you easily restart your script\n #xmEi5ZOJuHyI5cmR // ### October 2014\n #xnkgZyJ68CUy3ob1 // * when publishing, **add a release note** from the publish dialog\n #OkKSuSF4FBBR0jIS // * fork scripts and **[send a pull request](/pullrequests)**\n #rg4flIOCfg42dcfV // * `[go to]` now works for [extension actions](/extension actions) and [](/libraries)\n #ozPvx4o6D0mIKCYG // * **drag and drop** of statements in editor (when applicable)\n #iGxwLE2IEBp0mtrf // {pic:draganddrop:17x11}\n #aVJIaCI47ed62nvp // * libraries are bound a main script which allows to edit a referenced library and still run the script without switching.\n #Pn0iqqaRpZMaCsIR // * script comments are automatically loaded for earlier versions\n #gzErp0wP0OfPBo4T // * documentation can be browsed outside the editor at [](https://www.touchdevelop.com/docs)\n #K3MUP9gl62nlCIvO // * tutorials and documentation topics are automatically translated using Bing translator based on the browser language\n #vulQJpxFQTfIWRer // * the crowd-sourced localization of TouchDevelop has started! Try it out at [](https://touchdeveloptranslator.azurewebsites.net/)\n #hdQ0ZCKjkKssc0CV // * `box->set font family` allows to specify the font on a box\n #FQYXdoSkXUc82Uyx // * when renaming a local variable to a name that already exists, the editor proposes to merge the two variables\n #pvDy7RQo6TFK3JQZ box→set_font_family(\"Georgia\");\n #VKS8E7BPD7acVcd9 // * new `Sprite->left`, `Sprite->right`, `Sprite->top`, `Sprite->bottom` action to get the coordinates of the bounding box of a sprite.\n #rxbculFeHF4gcwv3 // * new `Buffer->concat`, `Buffer->read number`, `Buffer->write number`, `DateTime->milliseconds since epoch`, `math->div`, `web->encode uri`, `web->decode uri`, `web->encode uri component`, `web->decode uri component`\n #btWsFTctkwUp73lj // ### September 2014\n #Zizy5aFD6EU16ku6 // * new bear and pixel art tutorials leveraging the ``{stvalidator:...}`` macros.\n #vN6499h5IP4Ufmvl // * easy access to `app->log` through new button.\n #cE2MQC4SVXlvLHas // * richer logging infrastructure throuugh `app->create logger`\n #xr0ympiTptzn4h9r $logger := app→create_logger(\"my logger\");\n #pLB29ibkA6YwZyiU $logger→debug(\"a debug message\");\n #DbLce24L1veQ4HhT $logger→info(\"an info message\");\n #Wi1rReEWmIl7rQNT $logger→info(\"an error message!\");\n #B4gUxU6KbPiTzprj // * `Sprite->fit text` wraps the sprite bounding box around the text. `Sprite->set text alignment` allows to control how the text aligns vertically.\n #xda3VWfBlQDkajcz // * new ``{pici:...}`` and ``{sthashtags:...}`` macros for tutorials.\n #n1V224nUV7Hx7Bp3 // ### August 2014\n #xqmwBEi2K2Mx5XB3 // * `[comment out]` now shows up as an option when `[select]`ing lines of code\n #KDBouGJ0yqwbuLSC // * `[uncomment]`, `[strip if/for/...]` are now options when editing block statements\n #xmpTPUNKKU1NP1Z4 // * when you `[edit library]` from a script (which is now also more easily available) it adds a temporary link from the library to the parent script, so it's easier to go back and you can **deploy** parent script from the library; shortly you'll be also able to **run** it\n #xvEm557GPTJvAkdd // * new APIs: `Buffer->concat`, `Buffer->write number`, `Buffer->read number`, `math->div` (integer division), `DateTime->milliseconds_since_epoch` (epoch is, of course, 1970-01-01)\n #xi1ICDInif6b0xd5 // * tutorials with `{stvalidator}` now have access to `app->editor`\n #ducKZaXdvSn1LLWU // * Windows Phone 8.1 Update 1 is now supported\n #dKHLgvcRUKWRB84x // ### merging scripts\n #x9vdf8GQj929RnyG // At the bottom of info pages about published scripts there is now a new `[merge]` button. It let's you pick a target script in your account. It will then merge the changes between the common parent of these two scripts.\n #FS4bg5kyR0AJXVb8 // This feature is **beta** only.\n #xT4nXwphk9EENGK3 // ### July 2014\n #ptCPf721OV3p0bSr // * immutable types (i.e., ones which once created never change) are now marked with a little diamond\n #x6lLNbQg7et2EZAk // * new API `Collection->map to`, `Collection->ordered by`, `Collection->ordered by string`, `Collection->sorted` - higher order programming is coming to TD! we now also have `Collection->take`, `Collection->slice` as well as `create->collection of->...` for creating collections of arbitrary types\n #nr9bjJXxESYCawUV // * new `->wait for update` API on tables and indices\n #uq2o327lpSaTRI2S // ### June 2014\n #wYV4JrgD5s6FWI7t // * support for `Gamepad`\n #tgVzFk67GzK95nT0 // {pic:Xbox 360 gamepad:11x11}\n #efC2PV6rDZ5wWJSF $gamepad := senses→gamepads→at(0);\n #xMvOhtOZkTPT54DT if $gamepad→is_button_pressed(\"x\") then {\n #Utu0GZArBP4Iprto // shoot!\n }\n #Yrlb4Ry3y8K2yqvh // * custom validator in tutorials\n #VMedROHjGmtTxM80 // * split screen view in editor\n #dguL9eRXAIzNSOXO // ### May 2014\n #QWm8SUaVFH9e3eY9 // * `Task` now has `Task->completed`, `Task->value`, and `Task->await at most` [more info] (/asyncActions)\n #o0nc5EVOVV2R9g2h // * Logs are enabled also for published scripts\n #fOnZlHemD3JokxwO // * wait for messages from the parent frame\n #eQjUBLmGkFbpkASK $js := web→wait_for_message_from_parent(\"https://www.touchdevelop.com\");\n #xBTaJtW0yjIFW8y8 // ### April 2014\n #M0PSSIvUWBJWmqhi // #### Export to Android\n #ctXEW1KYFYvdXlH0 // Take your favorite script and [turn it into an Android app](/exporttoandroid)!\n #amczWXR0V2J7DYl7 // #### Export to Windows 8.1\n #kyhYUwojXgNfMI32 // We've updated our template and the exported Windows apps are now targeting 8.1.\n #kTE9uNrD2RWoBT8C // #### post and receive messages\n #xFLQsORmFJjTxlq8 // For the adventurous, it is now possible to post and receive messages between a TouchDevelop web app and its parent window.\n #x27TCdxiSFnSSMb4 // * post a message\n #xbK2liAPKS6bwodb web→post_message_to_parent(\"https://www.touchdevelop.com\", web→json_object);\n #IPRrn0QlLOhB36OK // * listen to incoming messages\n #ejJR3FUPFfM2qqPs web→on_received_message_from_parent(\"http://yourhostdomainname.something\", $received);\n #vLKi4zZGzwnvOZKR where received(json: Json_Object) {\n #zfHUftNJW4BFsMnC skip;\n }\n #h4LDm62JHbaOimTo // #### background pictures on boxes\n #tmivmy8mhcNZh7Nr // You can efficiently set one or more pictures as the background of a `box` using `box->add background picture`. The API does not impact the size of the box.\n #ZoveBWBWaAMGSRPz box→add_background_picture($pic, \"center center\", \"cover\", \"no-repeat\", \"scroll\");\n #hw6nBaRo847s9iil // #### hiding the title bar on pages\n #cN1c17sI2xSC1udr // You can hide the title and subtitle bar on the pages.\n #xEdUS4FJiwZ9cu64 wall→show_title_bar(false);\n #j2tWdyNbps42FXSb // ### March 2014\n #xtgXEU8BB93WTtil // #### Reorganized tutorials section\n #xF2Nm2dJhzBnD6Ul // As the list of tutorials grew longer and longer, we've reorganized them into categories. Tell us what you think!\n #Abb9Odg3L9wtP6CC // * [check out the new tutorials](/tutorials)\n #SWZt9P29nFdqDPWN // #### OneDrive support\n #wK1vvSAAQuubRjSe // Upload pictures to OneNote easily. The resulting `Cloud Picture` can be stored in an table or index.\n #i6Edi5yctYksdwAs $onedrive_pic := cloud_storage→upload_picture($pic, \"public\", \"\");\n #eixE9tEciDf527YB $onedrive_pic→post_to_wall;\n #gnsNGxGAvLzW8iPj // A `Cloud Picture` can be stored in tables and indices which allows to share them!\n #xUEtu327qEiqNCH5 // #### OneNote support\n #MOfJQ69dhYEfGh4Q // Create new pages in your OneNote with text, pictures and more!\n #Z6AD6VuAj7wvRmC3 $form := web→create_form_builder;\n #PmtsdZrr1bPrr6Wh $form→add_string(\"Presentation\", \"Yay!\");\n #FPKHJtraWucSSGz4 cloud_storage→upload_note($form);\n #tWo2ES4E2W2AxF2n // #### Arduino Esplora support\n #zk7g7nfYGBsnW4xB // Build scripts for the Esplora board using TouchDevelop! Look for the `[blank esplora]` template to get started.\n #InttAI7LPAREaWHr // * try the [esplora level tutorial](/esploraleveltutorial)\n #OjhdxFirqdh0Qxia // ### February 2014\n #mNMXPx1B3mJNvoXz // #### new refactoring: move to library\n #UFVd0ZAosyc8yuKN // Is your script getting too large to manage? Think about using the [move to library](/movetolibrary) refactoring support to move related elements of your script into a library.\n #rQqJWd7kKhaagTp8 // #### parallax backgrounds\n #RnNVp2kbW5LCV1Gb // Create awesome scrolling effects with the [background scrolling](/parallaxbackgrounds) support.\n #LKhR34KG7Qp8929Y $scene := $board→background_scene;\n #sXpKhu2tm8bVC4AF $back_layer := $scene→create_layer(0, art→nature);\n #On3ZT1H5qzrbg2h4 // Take a look at [this demo](#pub:cprja) from David Renton!\n #Sc0DUKR92oVvpXz1 // #### keyboard support\n #qm6AHO0Ztm5fF7ah // You can listen to key pressed on the keyboard (if available). You can listen to event or simply query for keys.\n #ByDk09RpVj9Qy89I // * attach an event. It will repeat automatically if the user keeps pressing the key.\n #xY2tf5SdjS2w7NwX senses→on_key_pressed(\"space\", $handler2);\n #gHo1W85uQlQ7AQFc where handler2() {\n #qQzuB57IuP2pRDf5 // Do something when space is pressed\n }\n #PJsvNHxqXEV4DpwY // * query the status of a given key\n #damdUTIZtFzTPOJD $b := senses→is_key_pressed(\"space\");\n #xgwYHHUeAswJjL23 // ### January 2014\n #UdpXhKxqwusZzcM9 // #### page models\n #HN3PLMP1v9TfStnm // [Pages](/page) now comes with an associated object type to store the **data**. It is edited together with the page in the **data** section (see example below). Every time the page is pushed a new instance of the page data is created.\n #PIgKRS2bXzpgRdv9 // {decl:show}\n #xLuQ6yyrI49hxwgI // #### timers\n #EzPTlUMkQ8MeNGad // Using `time->run after` and `time->run every`, you can schedule a handler of code to run once or at regular intervals.\n #tbjUYrS0xPoq4EZ4 time→run_after(3, $perform);\n #vl74hr7B4Ynhz4gh where perform() {\n #d137srI0VHIgQ42p // this code will run after 3 seconds of delay\n #SIAlx8bJyftKzpL5 skip;\n }\n #xLTuQBp8wQxge4o0 // The action `time->on every frame` allows to register a handler in a built-in game loop timer.\n #xs2TIThvzy4VmxSj time→on_every_frame($perform2);\n #VHQKoOSby2fgVy0G where perform2() {\n #xc6AoudLjgxb3kb8 // runs this code many times a second\n }\n #vI0j1XSJu32BYFH2 // #### inline events\n #D0b8PPRagmEnMBPj // We've added inline events for various global events. This means that you can attach (and detach) handlers to the `shake` event by using `senses->on shake`:\n #rUuLSLcoSl3H2r4s senses→on_shake($handler);\n #xlCmu8p3fAnRtNPw where handler() {\n #xnzuKlrGp4X55CHj // this code runs when the device is shaken!\n }\n #y2CRR2t1v2YVmuLP // Also added: `senses->on phone face up`, `senses->on phone face down`, `senses->on phone landscape left`, `senses->on phone landscape right`, `senses->on phone portrait`, `player->on active song changed`, `player->on player state changed`.\n #BhRIcWMBNbJvSgFD // #### maps\n #tk8SkFGqsFVJgeO0 // You can manipulate map **pushpins** easily: you can move thenm and register code on their ``on tap`` event.\n #uF2SA7ZTUdQZfvuh $map := maps→create_map;\n #Hgqk1s1QruxOWPzZ $pushpin := $map→add_text(senses→current_location, \"Yay!\", colors→accent, colors→white);\n #GKU7C0T2YuGvC1Yo $pushpin→on_tap($tapped);\n #AMTeUqcKWnOCSyyT where tapped() {\n #jlU4tkiDOjtZYvkl // runs when the user taps the pushpin!\n }\n #pAUqAIkNXXJCb9q3 // #### sprite sheets and animations\n #gGSGqj4mRdbLbkCH // A [sprite sheet](/spritesheet) is a picture that packs multiple images of an animation. It is commonly used in 2D games to create animations and efficiently package pictures together.\n #VDMtLedYw41T9Xb1 $sheet := $board→create_sprite_sheet(art→sheet);\n #xSaZgZfCa7PCKjv9 $sprite_ := $sheet→create_sprite(\"monster\");\n #x1gRQzNt9OCfUVf6 // Sprite properties such as opacity can be animated using [sprite animations](/spriteanimation).\n #iRBePYa2iGsxxJay $anim := $sprite_→create_animation;\n #nfZxLBbjP8x8yaSy $anim→fade_in(1, \"expo\");\n #AUlcOKPa0sQ8ZrC2 $anim→fade_out(1, \"quadratic\");\n #tENQxAxwNH3izuvf // #### obstacles\n #Dk9mqBesyVrHn4tD // The `board->create obstacle` returns an [](/obstacle). You can change the color or attach to events on the obstacle.\n #gJC20L3zXnGWyWoQ $obstacle := $board→create_obstacle(0, 0, 100, 100, 1);\n #BVV3SlloJE5xdWGq // * play a sound when an object bounces\n #NJCf0QLA4nM6HWg7 $obstacle→on_collision($bounce);\n #DFui22yFHSa20lr3 where bounce(sprite: Sprite) {\n #x2M80w4jYg0s4dsH // runs when a sprite bounces on the obstacle...\n }\n #n84Ok32Cpn7N1xz8 // * remove obstacle\n #FD8f8ntRjTFOYgFd $obstacle→delete;\n #pIrlAfuEH2f27VXp // #### other stuff\n #Gsjj7aKcN41DVmqS // * `senses->record microphone` support through [WebRTC](http://www.webrtc.org/)\n #siRQjDie3HsLnHy3 // * improvements in [](/libraries) documentation authoring\n #tB4O84e4OIJ4dllC // * customizable zoom factor for text (look in Settings in the Hub)\n #KeUiAm45I2EcZQD6 // * you can now define your own [action types](/actiontypes)\n #sn41TNhNQH2h5mxJ // * control structures (like `for` or `while`) are now displayed with an `end` keyword at the end. This makes it easy to add stuff after them and makes the scoping clear.\n #Us2LVnhyUmzSftLG // ### Older release notes\n #iuHW7I32l31xjT77 // * [what's new? 2013](/whatsnew2013)\n}\n#xDaFBvTdimT9orVbFsfSFNFA\naction show(#nb8QcaSLy2sZRFD6 \\u2756: * show_page_data) {\n #q3zqAKeTpljUqtLP if box→is_init then {\n #LtNAF02isq7bKo49 $\\u2756→counter := 0;\n }\n #i34bAjBmEr64ak5s if true then {\n #ctaNyxHk2oPV2rkg $\\u2756→counter→post_to_wall;\n #EAhNogbWhLE2FLDo box→on_tapped($handler);\n #s5Bl3Y1Ot2Zppsix where handler() {\n #fgBm1IJ8ju4qa46h $\\u2756→counter := $\\u2756→counter + 1;\n }\n }\n meta page;\n meta sync;\n}\n#BICBuYW1lICAa\ntable show_page_data {\n type = \"Object\";\n persistent = false;\n fields {\n #xUj2CwS6PTK5ZjC6yGL8Y8E6 counter : Number\n }\n}\n#dys4Eewl2C5GN3fDN4Rz9Mnz\nvar sheet : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/lvxdmali\";\n transient = true;\n}\n#zHH1uV1wY4qUHQzfaBkZaooz\nvar nature : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/pxuumvdl\";\n transient = true;\n}\n#BdGhpbmcgdGFibGUa\ntable thing {\n type = \"Table\";\n persistent = true;\n fields {\n #d7R6BWVqibW7FAhFCsKVV2vM pic : Cloud_Picture\n }\n}\n#xQ2tUepQG3htXvNC9XJ9Blq1\nvar Xbox_360_gamepad : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/qmrebwzq\";\n transient = true;\n}\n#MaJHONlLZA7msNcK\nvar draganddrop : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/ugbrfmxk\";\n transient = true;\n}\n#M0DWrZa7ca1vfLan\nvar pro_mode : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/flnuktvd\";\n transient = true;\n}\n#wuUz5Ma8wz5BM24J\nvar block_mode : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/ujvglgks\";\n transient = true;\n}\n#u1V47sacOEL1Wdh4\nvar arduino_blink : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/ilohpnvs\";\n transient = true;\n}\n", -"kdwc": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"blank minecraft pi\";\nmeta color \"#ffffffff\";\nmeta rootId \"UqtPMmqsRpLtBLICK3xNRKmo\";\nmeta iconArtId \"eopyzwpm\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n#ALKdKR1Vv5Af8ary\naction main() {\n #EzGPnaeUNsf2lJo0 $p := @\\u267b→minecraft_pi→player_→position;\n #VqIjTxbb4k1xKhyn @\\u267b→minecraft_pi→set_many_blocks($p→x, $p→y, $p→z, $p→x + 5, $p→y + 5, $p→z + 5, \"tnt\");\n}\n#K7YnTlN5QIpZ4sCp meta import minecraft_pi {\n pub \"epmc\"\n usage {\n action `async` `type` Block_Event_Action(hit: ♻ minecraft_pi → Block_Event)\n #BVGhpbmca\n table Block_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xNQF2IfWS5kUTCuC state : Number\n // Specifies the color or the id of the whool\n #xUNtn4WzFNh0J275 wool : String\n }\n }\n #xIIDIryL3GdLzzFH\n table Connect_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #IhKVKMjdA949jNr3 host : String\n #PQgsvjixlAlu49Bw port : Number\n #nlMXsJlluWZB1fNN proxy : String\n }\n }\n #umgRs0Idq3y9jRyc\n table Block_Event {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #SCV1txxxrjigP8XC kind : String\n #UIy6UFvY6WJWDDoA x : Number\n #wWASeEjKJDoiqrL2 y : Number\n #MkoIqcTcP3QiIoot z : Number\n #kYCW4sVB0Q5jQy0Q face : Number\n #EayHvTpmMjNF3Sfh entity : ♻ minecraft_pi → Entity\n }\n }\n #pqaWOjEWNqEkbxwJ\n table Position {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #L4NO4JXo2Sev2b1J x : Number\n #x2UU2Lt4BiV8NNNz y : Number\n #gw4VDwinZ6yVcwzL z : Number\n }\n }\n #eVDb6TwJ7CKitS8g\n table Repeat_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Delay in seconds between execution\n #VB0iDf9EazabCCQM delay : Number\n }\n }\n type Entity\n action `async` connect(options\\u003f: ♻ minecraft_pi → Connect_Options)\n action `async` set_block(x: Number, y: Number, z: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` set_many_blocks(x: Number, y: Number, z: Number, x2: Number, y2: Number, z2: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` block(x: Number, y: Number, z: Number) returns(name: String)\n action `async` height(x: Number, z: Number) returns(h: Number)\n action `async` chat(msg: String)\n action `async` position(entity: ♻ minecraft_pi → Entity) returns(pos: ♻ minecraft_pi → Position)\n action `async` set_position(entity: ♻ minecraft_pi → Entity, x: Number, y: Number, z: Number)\n action `async` test_commands()\n action `sync` is_connected() returns(r: Boolean)\n action `async` player_() returns(p: ♻ minecraft_pi → Entity)\n action `async` players() returns(players: Collection[ ♻ minecraft_pi → Entity])\n action `async` direction(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` rotation(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` pitch(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` player_by_name(name: String) returns(steve: ♻ minecraft_pi → Entity)\n action `sync` block_names() returns(names: Collection[String])\n action `async` repeat(@action: Action, options\\u003f: ♻ minecraft_pi → Repeat_Options) returns(t: Timer)\n action `sync` wool_colors() returns(cs: Collection[Color])\n action `sync` wool_color(c: Color) returns(name: String)\n action `async` on_hit(@action: ♻ minecraft_pi → Block_Event_Action)\n }\n #z2pxGKOLNF2QCShp resolve shell = ♻ shell with {\n }\n}\n#eM2G2nbehvbb7nDd meta import shell {\n pub \"qmzn\"\n usage {\n #BdGhpbmca\n table Exec_Output {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #YaaLgMz45N5ZuAeU success : Boolean\n #qrwQiGIhHhUhb8AF error : String\n #ijyQCE4KPQL2ziZD code : Number\n #wf4AkGfhLyWkyKhQ stdout : String\n #ZyLfqXXM99R1znCa stderr : String\n }\n }\n #ttC12C2SJrh1ODjl\n table Serial_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #wXa4BRcG6mdxKU25 delimiter : String\n }\n }\n type Command_Result\n type Shell_Socket\n action `async` write_file(path: String, content: String) returns(res: ♻ shell → Command_Result)\n action `sync` mkpath(folder: String, name: String) returns(path: String)\n action `async` mkdir(path: String) returns(res: ♻ shell → Command_Result)\n action `async` exec(cmd: String, cwd: String) returns(res: ♻ shell → Exec_Output)\n action `sync` logger() returns(logger: App_Logger)\n action `async` exec_file(cmd: String, args: Collection[String], cwd: String) returns(res: ♻ shell → Exec_Output)\n action `async` python_env() returns(res: ♻ shell → Command_Result)\n action `async` tcp_connect(host: String, port: Number) returns(sock: ♻ shell → Shell_Socket)\n action `async` receive(sock: ♻ shell → Shell_Socket) returns(netdata: String)\n action `async` send(sock: ♻ shell → Shell_Socket, netdata: String)\n action `async` close(sock: ♻ shell → Shell_Socket)\n action `async` serialport_connect(name: String, options\\u003f: ♻ shell → Serial_Options) returns(sock: ♻ shell → Shell_Socket)\n action `async` serial_list() returns(ports: Json_Object)\n }\n}\n", "kkwd": "meta version 'v2.2';\nmeta name \"physics game starter\";\n// Tap the screen to creates bubbles!\n\naction main() {\n // The board is a 2D canvas with a physics engine. Gravity makes sprites fall and boundary makes them bounce.\n wall→set_background(colors→random);\n data→board := media→create_landscape_board(800, 480);\n data→board→set_gravity(0, 400);\n data→board→create_boundary(0);\n $info := data→board→create_text(100, 20, 24, 'tap to create bubbles');\n $info→set_friction(1);\n // Display the board. The game loop will start after leaving main.\n data→board→post_to_wall;\n}\nvar board : Board {\n}\n\nevent gameloop() {\n // Apply physics and redraw.\n data→board→evolve;\n data→board→update_on_wall;\n meta private;}\n\nevent tap_board\\u003a_board(x: Number, y: Number) {\n // When the board is tapped, create a circle sprite that falls down.\n $circle := data→board→create_ellipse(100, 100);\n $circle→set_pos($x, $y);\n $circle→set_color(colors→random);\n $circle→set_friction(0.005);\n}\n", "krvn": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"blank docs\";\nmeta icon \"GPS\";\nmeta color \"#ffa1caf1\";\nmeta rootId \"kPNw3L4aANMbOhHGjD3Zu2QI\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// TODO: update the description. #docs\n#KuT2EaOAEn47T69Y\naction main() {\n #yiJrPOX5VkxgcJrp // You can use the [](/markdown) syntax to write **documentation**.\n #K1W8LqOgGHoaTE04 $x := 42;\n #velf3fNZzB4D7q65 // And interleave code as need or even insert snippets using the ``decl`` macro:\n #zrmo9BjVQdTGtzPL // {decl:main}\n}\n#xOiiduqfYBGjAp4X\nvar snd : Sound {\n is\\_resource = true;\n transient = true;\n}\n#LrnoHkgZHl46sgP8\naction test() {\n #aS25XlJHypSNPB32 skip;\n meta private;\n meta test;\n}\n", "krxlb": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync\";\nmeta name \"gamepad\";\nmeta icon \"JoyStick\";\nmeta color \"#ff9955bb\";\nmeta rootId \"xCYAjTKR25pBB4IRmMK0nm4f\";\nmeta isLibrary \"yes\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// A library that provides a virtual gamepad with keyboard, touch, accelerometer or physical gamepads.\n#main\naction example() {\n #iAAUNeoV3SRfYzb2 // The virtual gamepad that works for accelerometer, keyboard, touch, mouse or console gamepads.\n #Iq9tqh2gWM4rizSm // The library computes a vector that represents the orientation of a virtual joystick.\n #owlUjuL8ac2hBSAk // {hide}\n #FuQWVPr2FDIJMzYz $board := @\\u267b→game→start;\n #xgK3eb0xoxbkyneh $sprite := $board→create_ellipse(20, 20);\n #ZWPwsGsl9p64ZV3A // {/hide}\n #OmphHpb5CKI7uf6f // ### reading data\n #Vskl34wFNiYSQrbW // Use the `current` action to get the current angle of the joystick and the button status.\n #Xe4qJzFH1BMswBVG $p := code→current;\n #Govj2D79bADsyfG4 // The values ``x`` and ``y`` of ``p`` can be used to apply speed or acceleration to sprites. They are always between ``-1`` and ``1``.\n #xJS2TNmfJBQZzks4 $sprite→set_speed($p→x * 50, $p→y * 50);\n #xLS5Ne0GtAN3wBxc // The values of ``x`` and ``y`` ramp up from ``0`` to ``1`` or ``-1`` which allows to create smooth animations. They also ramp down.\n #gesKcthIr5iJV9Bf // ### handling button presses\n #LZHni02fBp8J2dYZ // The value ``z`` indicates if the button is pressed. ``z`` also ramps up from ``0`` to ``1``.\n #krIr922mSJTyUZQl $sprite→set_acceleration_y($p→z * 10);\n #xiCO9EoNc4Nerwbo // You can also register an action that will be raised when the button is first pressed. If the user uses a keyboard, this means that ``space`` is pressed, or it may be a mouse click or pressing a button on a gamepad.\n #qZu0cbj2DyIfzU52 $binding := code→on_button_pressed($@action);\n #imT7vW8zBSjB3Aop where @action() {\n #rVEC9zk3x0gC4OZb // flap the bird!\n }\n #GNOC4Ry9eimP29CM // Later on, you can use ``binding->delete`` to remove the action.\n #cfjCbfsrwwA0ZqyT $binding→delete;\n #gwgZhz1b4YvIekRt // ### controlling sprites\n #k2bfNyVWE76ny2I7 // The ``control sprite`` provides an easy way to control a sprite with the joystick.\n #jzhDiTAvPAg57yvr code→control_sprite($sprite, 50, 0);\n #xOJhGHYxDX6GHNuT // * where ``50`` is the maximum ``speed x`` so the sprite moves horizontally with the joystick\n #S908Ce7SKZnvE2Bg // * where ``0`` is the maximum ``speed y`` so the sprite does **not** move vertically with the joystick.\n #TxTHOrAKW201NNub // ### controlling the background scene\n #UHNq8hFA8hDCdhIg // Similarly to ``control sprite``, the action ``control backgroung scene`` will move the scene view position according to the ``current`` value.\n #SvPpf8Hshabf4Uvm code→control_background_scene(0, 10);\n #kRyIJdzWHDHzzqAe // ### accelerometer\n #x5sT7QqO3Ys47Gre // By default, the joystick uses the accelerometer if available. It can be disbales or enabled using ``settings->use accelerometer``.\n #H2L3DDUr5DSWJbOI code→settings→use_accelerometer := false;\n #AouqZGsi7N5U7ubU // When the accelerometer is used, touch is used solely to record button presses.\n #x2VFytPS2zWM4dlC // ### custom keys\n #jYpIpb7O5eCkMXG8 // By default, the keyboard uses the arrow keys and space. Use `set keys` to use a different set of keys.\n #gGG5PlUtox03FCmh code→settings→set_keys(\"a\", \"w\", \"d\", \"s\", \"space\");\n meta private;\n meta test;\n}\n#yPeu0IKvKxtuSD7c meta import game {\n pub \"sduub\"\n usage {\n action `sync` set_score(value: Number)\n action `async` set_life(value: Number)\n action `sync` start_timer()\n action `sync` start_countdown_timer(seconds: Number)\n action `sync` life() returns(r: Number)\n action `sync` score() returns(r: Number)\n action `sync` current_time() returns(seconds: Number)\n action `sync` add_score(value: Number)\n action `async` add_life(value: Number)\n action `sync` clear_timer()\n action `async` remove_life(value: Number)\n action `async` end()\n action `async` start() returns(board: Board)\n action `sync` reset()\n action `async` start_with_fixed_size(width: Number, height: Number) returns(board: Board)\n action `async` start_with_background_picture(pic: Picture) returns(board: Board)\n action `sync` board() returns(board: Board)\n action `sync` on_end(@action: Action)\n action `async` splash_text(message: String, seconds: Number, foreground: Color, background: Color, done: Action)\n action `async` start_landscape() returns(board: Board)\n action `async` start_portrait() returns(board: Board)\n action `sync` set_hud_colors(life: Color, timer: Color, score: Color)\n action `sync` hud_sprites() returns(sprites: Sprite_Set)\n action `async` life_visible() returns(b: Boolean)\n action `async` set_life_visible(visible: Boolean)\n action `sync` sprites() returns(sprites: Sprite_Set)\n action `async` set_background_scene(direction: String, pic: Picture)\n action `sync` bounce_on_sides()\n action `sync` create_sprite(pic: Picture) returns(sprite: Sprite)\n }\n}\n#qDcj96avRPrOW0HP9ddHIGDX\naction current() returns(#SPQYjzyoWvpeE5gt p: Vector3) {\n #ufnmt4tCZLjrO8Tw // Gets the current gamepad position. ``x``, ``y`` represent the angle, ``z`` represent the button. ``x`` is between ``-1`` (left) and ``1`` (right), ``y`` between ``-1`` (up) and ``1`` (down), ``z`` between ``0`` (released) and ``1`` (pressed).\n #K24bzS6d5dLCg70O code→initialize;\n #xAMQZhHolKwnH85G $now := time→now;\n #NKbyhJdf10449w1j $dt := code→check_last_current($now);\n #tvuqtvwZjf2WTFdV $vector := records→Vector→create;\n #SgjdVJE0JKpuCIDH $any_gamepad := false;\n #UCUZ4M8UBYsds6Bk foreach gamepad in senses→gamepads\n #PS1NasLc8vbJrVTF where $gamepad→is_connected\n do {\n #xlXsKI4PRPX0iBSR code→compute_gamepad($dt, $vector, $gamepad);\n #DyNM0jOUPeDyS6fX $any_gamepad := true;\n }\n #xBZ8zCuwMS8krcBu if `not` $any_gamepad then {\n #CyCCbKxg4vqTMewD code→compute_keyboard($dt, $vector);\n }\n #cwR4Eid54DDf549Z if data→\\_settings→\\_accelerometer then {\n #kp59r5CUOcmqTupl code→compute_accelerometer($dt, $vector);\n }\n else { #B9H3ZCbj5SQ03j7I if @\\u267b→game→board→touched then {\n #PGgITIMyD77HqtMV code→compute_touch($dt, $vector);\n }\n else { } } \n #jFEB3QBWrx0td7Uf data→\\_current := math→create_vector3($vector→x, $vector→y, $vector→z);\n #n6WZh7F4fYEQIvv1 data→\\_current_time := $now;\n #oDUWcYIBCj2AGWFI $p := data→\\_current;\n meta sync;\n}\n#LJp5GBFLELwUrK3r6yVHOfL1\nvar \\_current : Vector3 {\n transient = true;\n}\n#k7HatejkjqfIA242SSMpitAK\nvar \\_current_time : DateTime {\n transient = true;\n}\n#uYKZvu9VJlQJWlN4YZ8bPdOY\naction compute_touch(#EtnUI7jAfTxsnmC2 dt: Number, #lwWp15agk6qD4vdN vector: * Vector) {\n #Yc6Ljy2Kf77vAJE1 contract→assert( `not` data→\\_settings→\\_accelerometer, \"\");\n #aeff4ISwAiII2RYg $board := @\\u267b→game→board;\n #yo6SJ6XLPigLcePS $dist := $board→touch_current→subtract($board→touch_start);\n #nd4lO2qkviheKQQJ $r := math→min($board→width, $board→height) * 0.3;\n #xTZ3w0K2Vk4SDgG5 $m := math→max($r, math→max(math→abs($dist→x), math→abs($dist→y)));\n #x5FkjD7QKOi14bXx $p := $dist→scale(1 / $m * data→\\_settings→\\_keyboard_factor);\n #ar97E48abhnLItBH $vector→x := math→clamp( - 1, 1, $vector→x + $p→x);\n #xWe42O1gJ8jTOtYh $vector→y := math→clamp( - 1, 1, $vector→y + $p→y);\n meta private;\n meta sync;\n}\n#l4qZbEXuo0rCJ9p2l2546YMX\naction compute_keyboard(#agAE8QNlfT10TA8L seconds: Number, #QqtJbJ3bDDMJ6U1U vector: * Vector) {\n #xQvrhXDEZNLchRD1 $ramp := 0.4;\n #WqLlvN4eJaGlJC0G $deramp := 0.9;\n #GWAdBf4KVYtidymi $settings := data→\\_settings;\n #gOqhTN0E7f2RegEc $f := $settings→\\_keyboard_factor;\n #aAkuAGlBzQhKJw20 if `not` data→\\_current→is_invalid `and` $seconds > 0 then {\n #N0Bkg1ID2lRgdDtf $vector→x := data→\\_current→x;\n #lvUYGko8mZzeHc6V $vector→y := data→\\_current→y;\n #UQqL226sbMoeuKuS $vector→z := data→\\_current→z;\n }\n #j5LDrMTjvgNlPcNv if senses→is_key_pressed($settings→\\_left_key) then {\n #xn9Er5aq2bDVJi2I $vector→x := math→clamp( - 1, 0, ($vector→x - $seconds / $ramp) * $f);\n }\n else { #Kl0ql42NLDKUGvRF if senses→is_key_pressed($settings→\\_right_key) then {\n #Sqqq3YnIb2PBOqBS $vector→x := math→clamp(0, 1, ($vector→x + $seconds / $ramp) * $f);\n }\n else {\n #HayKmkb4wsCPhWA7 $vector→x := $vector→x * $deramp * $f;\n #pXLE351So9iM8EYM if math→abs($vector→x) < 0.05 then {\n #UKGenIUclEZAJnZ9 $vector→x := 0;\n }\n }\n } \n #xCOScmqJMBvGOFsF if senses→is_key_pressed($settings→\\_down_key) then {\n #mymWVgslyKEmFBDi $vector→y := math→clamp(0, 1, ($vector→y + $seconds / $ramp) * $f);\n }\n else { #ANgXb90ciinu1c08 if senses→is_key_pressed($settings→\\_up_key) then {\n #wzqzC3IBiGt83wCI $vector→y := math→clamp( - 1, 0, ($vector→y - $seconds / $ramp) * $f);\n }\n else {\n #H5PDO9dmid1b4OG6 $vector→y := $vector→y * $deramp * $f;\n #oVbCQ74UwHpbDU3m if math→abs($vector→y) < 0.05 then {\n #rdxiuAjRrQaBVDgJ $vector→y := 0;\n }\n }\n } \n #P7vuxXV4hIsABGid $click := data→\\_settings→\\_accelerometer `and` @\\u267b→game→board→touched;\n #NJia5AtUzVRAue2I if senses→is_key_pressed($settings→\\_button_key) `or` $click then {\n #jDP8eblTFKDgs0P4 $vector→z := math→clamp(0, 1, ($vector→z + $seconds / $ramp) * $f);\n }\n else {\n #bfu4Xe5wPIFVYSU0 $vector→z := $vector→z * $deramp * $f;\n #kctdFFz43brt9U5o if $vector→z < 0.05 then {\n #Y8kiexxwCtaTI1EQ $vector→z := 0;\n }\n }\n meta private;\n meta sync;\n}\n#AKyPSHgYSnMUTq5QWdoGYf4b\naction check_last_current(#xjgjVLBvL0WGZ6YX now: DateTime) returns(#Thizg9eKf28lICqA dt: Number) {\n #ObcOFDPPp9WxhSt2 $dt := 0;\n #Kb72ZpRTA3m4Kp8U if `not` data→\\_current→is_invalid then {\n #x8ik4sk6ewFwAcfS $dt := $now→subtract(data→\\_current_time);\n #Ew4zlsnuP3h4JSI9 if $dt > 1 then {\n #EXRHRdWwI0F4HPp8 data→\\_current := invalid→vector3;\n #SquuGsAcxSF7COR1 $dt := 0;\n }\n }\n meta private;\n meta sync;\n}\n#UJBkmukg7xj2SmmTAcdYmdmZ\naction test() {\n #jHqREyI9wOqOCUqc $board := @\\u267b→game→start;\n #inxjywJVM590S1zh $board→set_debug_mode(true);\n #xGbKRxfvo4Q93kKk $sprite := $board→create_ellipse(100, 100);\n #Ic9uUBobqM3degOG $board→add_on_every_frame($perform);\n #xqlRo4rJOJlPMyen where perform() {\n #xM22BN7aFmcIrgzt $p := code→current;\n #RP4MWoA4i0njhVTB time→log(\"current: \" ∥ $p);\n #sUHisiH35bEla3UR $sprite→set_speed($p→x * 150, $p→y * 150);\n #yuKJPVDFO1cFN4g1 $sprite→set_color(colors→wheel($p→z));\n }\n #d4220TFiigYosuSS code→on_button_pressed($@action);\n #K46EjvEbVdCKdBQ4 where @action() {\n #UkfR0OrhfR70BXgP $anim := $sprite→create_animation;\n #rlbsft24Zld2dOXf $anim→beat(1.5, 2, 1.2);\n }\n meta private;\n meta test;\n}\n#xLL5SIqze7BJH9jArgnxFL1w\naction set_keys(#F1fwvPuXyWqOAgyE settings: * Settings, #qCVhDclIfaTvxR48 left: String, #jItXnxypevC73xkO up: String, #phYJQlteKaNIY8Fy right: String, #Rhj5ziYa0g1IgTfO down: String, #fGxfwRyt0642IsC2 button: String) {\n #eF8U1KL4QoC09Dpz // Sets custom keys to control the joystick.\n #jdZihqWH7R4PPh2k // {hints:left:left,a}\n #timneyKMpZRrUy2P // {hints:right:right,d}\n #KlUDH8tXmhEvDhke // {hints:down:down,s}\n #mkQo4n8pPyFWS4CB // {hints:up:up,w}\n #x5gUEO14aZOvuWdZ // {hints:button:space,enter}\n #mA2kmO4mS2sB0gGU code→initialize;\n #QtLmAF0x3BKCuNN4 contract→requires( `not` $left→is_empty, \"missing key\");\n #APG86c6eW0q18zKm contract→requires( `not` $right→is_empty, \"missing key\");\n #XI8oeyxHEGG9pdE3 contract→requires( `not` $up→is_empty, \"missing key\");\n #xamto1IEQdzpF94F contract→requires( `not` $down→is_empty, \"missing key\");\n #u7zsrNBpl2YMnGxa contract→requires( `not` $button→is_empty, \"missing key\");\n #xX6kINu4smLfSU4V $settings→\\_left_key := $left;\n #xgvIJTVCRXCbzX0v $settings→\\_right_key := $right;\n #qBkkp8802szSl6Ku $settings→\\_up_key := $up;\n #xxqcuvdCnDlG2zXt $settings→\\_down_key := $down;\n #NNy2TBcsHPoSB5HX $settings→\\_button_key := $button;\n meta sync;\n}\n#hUUrbnz6QsXzbuBs4lLmaY67\naction set_use_accelerometer(#sMb8yT6LjTfyQf66 settings: * Settings, #ZWB7PFBsxcVwbmuO enabled: Boolean) {\n #MhCet6v5VrZkHYm5 // Sets a value to enable using the accelerometer to control the joystick, if available.\n #xJbQ5KBVWJ2ZC4wt $settings→\\_accelerometer := $enabled `and` senses→has_accelerometer;\n meta sync;\n}\n#NARYT4r1qcmrRmDNdAjtkOcD\naction compute_accelerometer(#x2GnG1i2JgFiTdyI dt: Number, #l0iot4LcZEAUCbBo vector: * Vector) {\n #CdB24VEl10I21wlN $p := senses→acceleration_quick;\n #JHkzPnuUlv7pCGrG $x := data→\\_settings→\\_accelerometer_factor;\n #YunhQWUn2P4CqgQO $vector→x := math→clamp( - 1, 1, $vector→x + $p→x * $x);\n #Eb4F6YvngxPCmqxQ $vector→y := math→clamp( - 1, 1, $vector→y + $p→y * $x);\n meta private;\n meta sync;\n}\n#BdGhpbmca\ntable Vector {\n type = \"Object\";\n persistent = false;\n fields {\n #PIhmB5a45eV2GwDOel4fNJzD x : Number\n #s4RJLddQmZAAL2fVNJZlofpI y : Number\n #z4sZT4jEURZzF4qvBK80374u z : Number\n }\n}\n#Pp43nHG2nxgTrXqtYtq2qQ3n\naction use_accelerometer(#x4AqNqJN2AV8FyNW settings: * Settings) returns(#ZuecI66sdYrN0fLg b: Boolean) {\n #xKiBqWGiPgb8OodJ // Gets a value indicating if the game pad is in accelerometer mode\n #iyQVQkZox7faFtMZ $b := $settings→\\_accelerometer;\n meta sync;\n}\n#Jr5PkqN8lT3CcCaI8FkcwY9i\naction control_sprite(#J4bQtf4dzt0JJv0o sprite: Sprite, #xITne2vAd7GGo71K max_speed_x: Number, #eh4guxKhGAkkT5zd max_speed_y: Number) {\n #pZFTfhm2KibBy4vb // Attaches code to a sprite so that it moves with the joystick. ``max speed x``, ``max speed y`` are the maximum speed in the horizontal and vertical directions. If the ``max speed`` is ``0``, the sprite does not move in that direction.\n #gqAAXsRX7ML6Xp6Q // {hints:max speed x:10}\n #XYUBw2I2PmJxsfQk // {hints:max speed y:10}\n #QJN5pdrnm402r4nc contract→requires($max_speed_x ≠ 0 `or` $max_speed_y ≠ 0, \"max speed x or max speed y must be positive\");\n #SdQfPla60i8KOB69 @\\u267b→game→board→add_on_every_frame($perform);\n #dzrdQXYVBuiYpCB3 where perform() {\n #kMPKcC4hlDnlAzNf $p := code→current;\n #m84DBIk76JwFXGtK if $max_speed_x ≠ 0 then {\n #AIc6bHmDGE5KEkub $sprite→set_speed_x($p→x * $max_speed_x);\n }\n #FlHS37vNSYlJzzK2 if $max_speed_y ≠ 0 then {\n #kcqg248K96z8hSvW $sprite→set_speed_y($p→y * $max_speed_y);\n }\n }\n meta sync;\n}\n#xOCxKZH5B5Fbbm2N2BgFeCjp\naction control_background_scene(#xexUUg8AFUV1pKss max_speed_x: Number, #husVqChs0aLNEthp max_speed_y: Number) {\n #xvNWw6U8MHjXt8Af // Attaches code to a sprite so that it moves with the joystick. ``max speed x``, ``max speed y`` are the maximum speed in the horizontal and vertical directions. If the ``max speed`` is ``0``, the sprite does not move in that direction.\n #YJZmMvKMLvYxEwDY // {hints:max speed x:5}\n #BVh2sKVCrb3m56WT // {hints:max speed y:5}\n #EmBN4lPPQPbBchh1 contract→requires($max_speed_x ≠ 0 `or` $max_speed_y ≠ 0, \"max speed x or max speed y must be positive\");\n #TZWQZIGfZ68yG9Uv $board := @\\u267b→game→board;\n #wPA2oQGbTH3FGzOZ $scene := $board→background_scene;\n #Js4Zpc34CRxt2GeX $board→add_on_every_frame($perform);\n #ZWthGFblITdJ5y2q where perform() {\n #xLolGpyPJ26Bf7gF $p := code→current;\n #NRgvlWpZblB5411Z if $max_speed_x * $p→x ≠ 0 then {\n #x9XySL1IghJ4eAkc $scene→view_x := $scene→view_x + $p→x * $max_speed_x;\n }\n #zAl92h1NWX6zV6YZ if $max_speed_y * $p→y ≠ 0 then {\n #v2doU4uETj8wdBU6 $scene→view_y := $scene→view_y + $p→y * $max_speed_y;\n }\n }\n meta sync;\n}\n#O5jlHid249RIgTQx4Il4dMsQ\naction initialize() {\n #BY1a8ZelCHXrWspS if data→\\_settings→is_invalid then {\n #xG5gN3ayZLIr97Kv data→\\_settings := records→Settings→create;\n #xg65D2HGMuN6YvRl data→\\_settings→\\_left_key := \"left\";\n #Qvua74YQy1S3NWOW data→\\_settings→\\_right_key := \"right\";\n #UtF8HSgpBFH4GOCh data→\\_settings→\\_up_key := \"up\";\n #x8LXxXent3EQ3HSb data→\\_settings→\\_down_key := \"down\";\n #eHrpy4kjLd3kKU7H data→\\_settings→\\_button_key := \"space\";\n #JrohHVSmIOHoTJfg data→\\_settings→\\_accelerometer := senses→has_accelerometer;\n #QLmAnO22zSclfJLh data→\\_settings→\\_accelerometer_factor := 2.5;\n #FoOj1D7azTBsWmAS data→\\_settings→\\_keyboard_factor := 1;\n #gE4FhHuKQInXChc6 data→\\_settings→\\_touch_factor := 1;\n #x4HLjy5jtRlZw5QK data→\\_settings→\\_gamepad_factor := 1;\n }\n meta private;\n meta sync;\n}\n#EBTBDXQl4wWAeztoI6v6uXr7\ntable Settings {\n type = \"Object\";\n persistent = false;\n fields {\n #xWrudrZ5NpJdyPTY \\_accelerometer : Boolean\n #haeXdtH8UXoKT2YiPEqLa2fY \\_accelerometer_factor : Number\n #xU41NwX1DW2EsOH1zEyKrBDI \\_keyboard_factor : Number\n #gs0C5qUDfkJQgVZNTRvcYXdg \\_touch_factor : Number\n #xye4E9Gkn75xPO9BypOVNnQl \\_gamepad_factor : Number\n #zJxyk6doic4epMgg \\_button_key : String\n #xTqBB94SCy85xBDo \\_left_key : String\n #xcK10crRhLYLIPRa \\_right_key : String\n #teqHhpmPMmsqCDDe \\_up_key : String\n #O8zLW0tiUKq2Iq6m \\_down_key : String\n }\n}\n#wzrHF0ZiaaIPCBlykVeDL7ZQ\nvar \\_settings : * Settings {\n transient = true;\n}\n#fZA6Z6A6AZBTzGzFKUi45Qkk\naction settings() returns(#x2440FgmL0FXNm2Y sets: * Settings) {\n #H4fuepz89B5nVk5c // Gets the settings\n #NYeQ8DS6Yk6rvaoH code→initialize;\n #J0zI5t9SBqZz2A3Y $sets := data→\\_settings;\n meta sync;\n}\n#JsMMnNP4PoTsmzcKQb03lxcd\naction set_accelerometer_factor(#hV904uzJQP4Ha1vL settings: * Settings, #UZL9DHRMGQZ1SjJc factor: Number) {\n #U2OMRDlAavZbU8QD // Sets the accelerometer factor which defines the sensitivity of the gamepad to acceleration.\n #KQOkRcPNYlYc4rfq $settings→\\_accelerometer_factor := $factor;\n meta sync;\n}\n#qHUjP3JxEIe6PglgPBd7XvGj\naction set_keyboard_factor(#xoDt4HwFM7Xtn50y settings: * Settings, #BXbMcZD3FCEFxd74 factor: Number) {\n #oEa4VV4P5Qcw4LxT // Sets the keyboard factor which defines the sensitivity of the gamepad to keystrokes.\n #I22dHuBIaCE4Wsfg $settings→\\_keyboard_factor := $factor;\n meta sync;\n}\n#ykOjMaqh0yuACa3eucm2crhX\naction set_touch_factor(#x9g9UuMQ0nWvsOOr settings: * Settings, #xB4ys583aKS4LhSA factor: Number) {\n #xxTdZjauXHuYGsze // Sets the keyboard factor which defines the sensitivity of the gamepad to touch position.\n #xDWukfE0Nb0J1SEB $settings→\\_touch_factor := $factor;\n meta sync;\n}\n#HkT5dDFCgut23pzIiUtT5449\naction accelerometer_factor(#x42Ymf1w793HBMrM settings: * Settings) returns(#J3b5CTzLR5bnRzDd factor: Number) {\n #x2ohapkwxTl4TJm2 // Gets the accelerometer factor which defines the sensitivity of the gamepad to acceleration.\n #ubiUm8C4Qa37zXl9 $factor := $settings→\\_accelerometer_factor;\n meta sync;\n}\n#ojPViw2hIEo2FhK11HwNyfHv\naction keyboard_factor(#xIAMPIUEzeeI4MSo settings: * Settings) returns(#qer1Gid3Ka1sYUlo factor: Number) {\n #DZ0tTbGBLf0zdvaN // Gets the factor which defines the sensitivity of the gamepad to keystrokes.\n #hQzKDt4MvV3eZ3y0 $factor := $settings→\\_keyboard_factor;\n meta sync;\n}\n#cmxAcycEZOsCpQnldHU6eNUe\naction touch_factor(#xi4zCqnOSG7a3FJ9 settings: * Settings) returns(#cWB3AVRhR2UxhY5M factor: Number) {\n #adW5EhfLFYOS1SN4 // Gets the factor which defines the sensitivity of the gamepad to touch.\n #xoHybh1K0DH2JE6U $factor := $settings→\\_touch_factor;\n meta sync;\n}\n#qDlKG3i3k2K4V8WDC0PeMN11\naction compute_gamepad(#sNZCyEA7PtuE1Ja2 seconds: Number, #oxn5BeCE5Z9fBJri vector: * Vector, #yC3saYaNHw0wr46w gp: Gamepad) {\n #J7ujsf4vd2ZdQS4j $ramp := 0.4;\n #aIps1tsTQVIXzE48 $deramp := 0.9;\n #Np91rQPyO6dT6h0r $f := data→\\_settings→\\_keyboard_factor;\n #SOG2l2YssSdmyfJ6 if `not` data→\\_current→is_invalid `and` $seconds > 0 then {\n #TYEiJepb5OzRK4Ue $vector→x := data→\\_current→x;\n #SrTapAnFDCPENlkk $vector→y := data→\\_current→y;\n #Q3jerK4ei022TcO4 $vector→z := data→\\_current→z;\n }\n #nm6km479Qkl8nmTz // digital commands\n #x41OxuSqcvPpFBvT $p := $gp→axes(\"left stick\");\n #af6ujQZDY57S69tr if math→abs($p→x) > 0.07 then {\n #NLqjhSODtwJdvmKn $vector→x := $p→x;\n }\n else { #xH41FZCtrksP73Im if $gp→is_button_pressed(\"left\") then {\n #ULPRruprvYXYBBBV $vector→x := math→clamp( - 1, 0, ($vector→x - $seconds / $ramp) * $f);\n }\n else { #kJfsCJRarGkYDJo5 if $gp→is_button_pressed(\"right\") then {\n #HPux3qopIyjD40mF $vector→x := math→clamp(0, 1, ($vector→x + $seconds / $ramp) * $f);\n }\n else {\n #jzdCQpkG1NhYRxJK $vector→x := $vector→x * $deramp * $f;\n #xfezCQnnAlipaL2h if math→abs($vector→x) < 0.05 then {\n #L2AiamuB1W6laju5 $vector→x := 0;\n }\n }\n } } \n #syDnE1OdmuOcz7JJ if math→abs($p→y) > 0.07 then {\n #BJOkzjS2t6qrFqOs $vector→y := $p→y;\n }\n else { #xvn3AVRyEYWu4vmX if $gp→is_button_pressed(\"down\") then {\n #EcM7LTmETJGKXq7k $vector→y := math→clamp(0, 1, ($vector→y + $seconds / $ramp) * $f);\n }\n else { #thLr6SB1G4GOz9KA if $gp→is_button_pressed(\"up\") then {\n #sfKxmyqJIrEyAIEI $vector→y := math→clamp( - 1, 0, ($vector→y - $seconds / $ramp) * $f);\n }\n else {\n #x0qsG75vhyV1OTI3 $vector→y := $vector→y * $deramp * $f;\n #xED8wNfNIawJhHlB if math→abs($vector→y) < 0.05 then {\n #ud5B1uYehyoXkvFL $vector→y := 0;\n }\n }\n } } \n #Gp6XE26xRnkZH1UF if $gp→is_button_pressed(\"x\") `or` $gp→is_button_pressed(\"a\") `or` $gp→is_button_pressed(\"left trigger\") `or` $gp→is_button_pressed(\"right trigger\") then {\n #xY1aCbyRrl4WRQzr $vector→z := math→clamp(0, 1, ($vector→z + $seconds / $ramp) * $f);\n }\n else {\n #rlwfZwqD5NQN3FYU $vector→z := $vector→z * $deramp * $f;\n #xqZ0ek76dg18mmKi if $vector→z < 0.05 then {\n #xM1wils39LR2R2r1 $vector→z := 0;\n }\n }\n meta private;\n meta sync;\n}\n#Q5iYM4d4RaKAHW0EBSJVw4Ax\naction gamepad_factor(#EzeyG4fwIy72v43H settings: * Settings) returns(#iQoR4aWzVHrOCNUa factor: Number) {\n #x4QTtaWY5KjaOBX6 // Gets the gamepad multiplaction factor\n #Da02a7PsI4JZXbHz $factor := $settings→\\_gamepad_factor;\n meta sync;\n}\n#BKrrtzJkT6r8eMJwqbQ4H4uv\naction set_gamepad_factor(#lCTVkfU4Lf2pn4WH settings: * Settings, #wYwRD3xQjAfRM1XF factor: Number) {\n #rWKLWdtv08NDnClQ // Sets the gamepad factor\n #kizmsK2S0IHazy2g $settings→\\_gamepad_factor := $factor;\n meta sync;\n}\n#WXa1HIFpjLPPuHwF\naction on_button_pressed(#f4HaMUK2POpX1XK2 @action: Action) returns(#bYZ65CfJ1xqucFvz binding: * Gamepad_Event_Binding) {\n #autpkZS0K0HiSnJ6 // Raised when the primary button is pressed. The button could be the keyboard ``space`` key, mouse click, touch tap or the ``A`` gamepad button. Auto-repeat is not supported.\n #Rk7sWmHqManf2FxK // {action:ignoreReturn}\n #kCNUrJ58ODLFjqSE $binding := records→Gamepad_Event_Binding→create;\n #ruht2urgD9P0Owdx $binding→bindings := create→collection_of→event_binding;\n #MVLlCR56fgCGJEwb $ev := senses→on_key_pressed(\"space\", $handler);\n #P3izRPTD4J4M0Utd where handler() {\n #ad3dhq1Q6xkQBaw3 $@action→run;\n }\n #IJCZAy2QOOIGsiph $binding→bindings→add($ev);\n #nQ0624TgT5d7Np4l $ev2 := @\\u267b→game→board→on_tap($tapped);\n #FI2pqcbqJr5B5nYd where tapped(x: Number, y: Number) {\n #wL3nosJAQfhAa9jG $@action→run;\n }\n #b4DyggOZsb42VJew $binding→bindings→add($ev2);\n #A0Kvs4Rx4Zez5CLb $state := records→Button_State→create;\n #gg0O0MVZAT1CAzK2 $btn_name := \"a\";\n #Z5xTM2xdjWs32GnQ $state→pressed := code→is_button_pressed_in_any_gamepad($btn_name);\n #ES84jGq7VtcYYzsk $ev3 := @\\u267b→game→board→add_on_every_frame($perform);\n #xkNjoDPruQAqd4Vy where perform() {\n #H1O6JVSByAsdB5gl $pressed := code→is_button_pressed_in_any_gamepad($btn_name);\n #XBao9npXj3jLj44Y if $pressed `and` `not` $state→pressed then {\n #zrfrKef5j3G6I87r `async` $@action→run;\n }\n #Qp92pguhEJ964LjX $state→pressed := $pressed;\n }\n #xjU7OfAyEY1t2Zlg $binding→bindings→add($ev3);\n}\n#PtpGyZJTdYtckhRv\ntable Button_State {\n type = \"Object\";\n persistent = false;\n fields {\n #SrkEX4XZd2hpMRGQ pressed : Boolean\n }\n}\n#MqSmFDsxMgTB4xkn\naction is_button_pressed_in_any_gamepad(#xU2rD4who6rykMde btn_name: String) returns(#x04nfMmco3aGZUlD pressed: Boolean) {\n #C7AW20Gvnp2I6cxZ $pressed := false;\n #AZmGfN4J5U6UVomG $gps := senses→gamepads;\n #YlD0rGhPyywGrYvr foreach gamepad in $gps\n #zi4HbWuQNS1TGoqd where `not` $pressed `and` $gamepad→is_connected `and` $gamepad→is_button_pressed($btn_name)\n do {\n #gzc7udJGZ2ZXqcDr $pressed := true;\n }\n meta private;\n meta sync;\n}\n#B5CwXDSpNzCP42Ri\ntable Gamepad_Event_Binding {\n type = \"Object\";\n persistent = false;\n fields {\n #ftimFuL4HLLtCtfV bindings : Collection[Event_Binding]\n }\n}\n#x3PpQGVlqDg5FKmt\naction delete(#xR9VnFvk412nTGrw binding: * Gamepad_Event_Binding) {\n #mzSlbL2z6dbP8sib // Deletes all the bindings\n #c0BBfqA8y3oFMZyX foreach ev in $binding→bindings\n do {\n #vth7W3m3aQtq02TK $ev→delete;\n }\n #JpIxBpOLfLjBVWZO $binding→bindings→clear;\n meta sync;\n}\n", @@ -25,7 +25,7 @@ "lyjec": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync\";\nmeta name \"contents\";\nmeta rootId \"xD9L5v3m9GPYhDNjn5CSnE5o\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// Documentation. #docs #content\n#OVgF8idv6dH4kLiKyBNuGLSY\naction main() {\n #xfl4uVD2RY4FWYpg // {priority:1}\n #xyAN4z6sCQKOwHWc // Welcome to TouchDevelop, a friendly **mobile app creation environment**. With TouchDevelop you can create apps on your mobile phone, tablet, and PC, and share the apps you create in the cloud.\n #g3DL66Cb9S0ZegTR // ## contents\n #QOmTj1hDA4y6mKlZ // * [Getting Started](/gettingstarted) Learn more about TouchDevelop, and create your first app!\n #nth3IKoU9pTSwIb1 // * [Language Reference](/language) Dig into the details of coding with TouchDevelop.\n #xNCKcYSczgDz7V9A // * [API Reference](/api) Explore the TouchDevelop API, and learn more about the services, types, and action types.\n #xequzJYQ145qm2Zw // * [Tutorials](/tutorials) Expand your knowledge with lots of great tutorials, from games to connected data sharing apps.\n #iN4Ls0QhUddrt9Dg // * [Social Coding](/socialcoding) Understand how to publish, share, merge your scripts with the TouchDevelop environment.\n #c72LZaRxP2NDOTnK // * [Advanced Topics](/advancedtopics) Move beyond the basics and learn about testing, debugging, performance profiling and more.\n #YHnFwRwN2EXUj90o // * [Teach](/teach) Find out more about creating custom tutorials, and using TouchDevelop in the classroom.\n #ADc1YaDiZ2O74NSJ // * [Games](/games) Discover techniques for creating lots of different types of games.\n #mZEveK8nVUnOOwxh // * [FAQ](/faq) Get answers to your questions with the TouchDevelop FAQ.\n #JHO1xs6a3UF852aE // * [What's New](/whatsnew) Read our release notes for news on the latest features and fixes.\n #ynfwmb0zxcfVhs4p // * [Blog](/blog) subscribe and follow the TouchDevelop community blog\n #x4IdZphhhSfUG283 // ## legal information\n #uvgx7BQH12ER67f9 // By using TouchDevelop you agree to the [Cloud Services Agreement](https://www.touchdevelop.com/legal) with Microsoft Research. Please read our [Privacy Statement](https://www.touchdevelop.com/privacy).\n}\n", "mdrw": "meta version \"v3.0,js,ctx,refs,localcloud,unicodemodel,allasync,replay,partial\";\nmeta name \"blank pixel art\";\nmeta icon \"NineColumn\";\nmeta color \"#ff9955bb\";\nmeta rootId \"VBXALpufM78Zg6nXlU4VkoKX\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// A pixel art script. #pixelart\n#RgqvETdZVOPoT1G4\naction main() {\n #QECmOCB8D9No5rO6 @\\u267b→pixel_art→set_pen_color(colors→random);\n #xO2UVI7FHoavaFrj @\\u267b→pixel_art→paint(8, 8);\n}\n#TTrakYktVjHUznf2 meta import pixel_art {\n pub \"tsrn\"\n usage {\n action `sync` create(terrain: String)\n action `async` test()\n action `sync` set_pen_color(c: Color)\n action `sync` pen_color() returns(c: Color)\n action `async` paint(x: Number, y: Number)\n action `sync` pixel(x: Number, y: Number) returns(c: Color)\n action `sync` sides() returns(cols: Number)\n action `async` test_fail()\n action `async` test_success()\n }\n}\n", "mfvka": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"touchdevelop local\";\nmeta icon \"GlobeEUA\";\nmeta color \"#ff007fff\";\nmeta rootId \"O6Rs2BjFB4g0ArT2oat8Gpfc\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// Explains how to export a script to the App Store. #docs\n#main\naction main() {\n #YKeb2CW4sOdvQyW9 // {parentTopic:contents}\n #xSh4e5kqwQHcBmkx // It is possible to run TouchDevelop from a local web server on your machine. This allow TouchDevelop to work completely offline, access services required for [app generation](/exporttocordova) or code with [Minecraft](/minecraftpisetup).\n #x35eEyKbLVKI0YGH // ## installation steps\n #juuuaj9Ro2J2Clco // * install [node.js] (http://nodejs.org/)\n #c72W0S2LKE5DVZEb // * create an empty folder for your projects\n #xFRR2AdHdpXNY6Tp // * open a command prompt in your fresh folder and install the **touchdevelop** npm package.\n #hxp4ucOoAsva9ecH // > ``npm install -g http://aka.ms/touchdevelop.tgz``\n #FDTBrovQEeBZm4YP // * launch TouchDevelop locally (make sure you're in your fresh folder)\n #VdVeyI6zCWRyKLoA // > ``touchdevelop``\n #jB3SWBY83Ya2hQve // This will start the TouchDevelop editor in your default browser.\n #GG0Wwd79o4DWGali // ### using non-default browser\n #c9GeLb0N1ocQTHV0 // If you want to use a different browser run ``touchdevelop --cli`` and then point your browser to the URL printed out, it will look **something like** this:\n #Zt9aw3IdHQhkjOAj // > ``Editor URL: http://localhost:4242/editor/beta#td_deployment_key=``\n #A85X0jwZQ7nxKmA7 // It is very important to copy&paste the deployment key at the end precisely.\n #oZCkpuvERU4pSBgP // ### caching of resources\n #HZg9zZ33hRQewElr // All [art resources](/art) or scripts that are loaded while using TouchDevelop local are automatically cached on disk, which allows for a better experience.\n #dOWKEqjA2EopKrAa // If you are planning to package TouchDevelop, make sure that you use at least once each required script or tutorial so that they get cached.\n #xJW2i0dpR9ECZHbH // ### packaging\n #xk9FWWSoKznWnmdy // If you plan to package and share your local touchdevelop, you need to perform the following step.\n #OWX4ZYDjngkiBEtL // * go to the **hub**,\n #gHhslghRyoF9m2FR // * tap on `[Settings]`\n #xpnUIIdzjeb32vYB // * tap on `[save offline caches]`\n #HBWc0AdjvaE1PBPq // Copy or zip the folder containing the TouchDevelop files.\n}\n#lRC7ZP4I3ytfLfcRhscBaKF6\nvar monster : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/ymggwtmn\";\n transient = true;\n}\n#xZA3MGCJ6sAJtfqSibDFTyzZ\nvar @1_Click_on_Title : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/syhbuwmb\";\n transient = true;\n}\n#x4oXuBrRP7peqBxOraPy0Ppu\nvar @2_Publish_Script : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/uegejzev\";\n transient = true;\n}\n#Pb7ZRhh1Le4Kwz16DOm6h95t\nvar @3_Click_Export_iOS : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/snnlubem\";\n transient = true;\n}\n#JiJThBxgjuQyZZagv84V67Cc\nvar @4_Export_to_App_Store : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/jhmzbank\";\n transient = true;\n}\n#u2byTeHW2wX14mnA374fzvSh\nvar @5_App_is_Ready : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/pnqogdug\";\n transient = true;\n}\n#XhCWNpaqagoeYlvuBl6OZOHa\nvar @6_Search_for_Xcode : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/ukwoekck\";\n transient = true;\n}\n#ZeXqju7M5bfqlm0Gx6CYvtRK\nvar @7_Open_Xcode : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/akluqtvy\";\n transient = true;\n}\n#xzO7Z4FWRmvE3GvB3nUQGdja\nvar @8_Open_Project_Folder : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/duqdaaut\";\n transient = true;\n}\n#JOEveTZ34fcQQBSty0Y64Edz\nvar @9_Run_on_Simulator : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/vxmsyaas\";\n transient = true;\n}\n#xiLx3rI7m5QO2Xo18r4e8IkZ\nvar @10_New_App : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/mpgptjat\";\n transient = true;\n}\n#xvxHs2DcS5TxtO3WUNGJU8SX\nvar @11_App_Info_1 : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/ogcsqjwj\";\n transient = true;\n}\n#ZrjNZAJFXA9xGxb5V6oiQ2fr\nvar @12_App_Info_2 : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/sqvolvpy\";\n transient = true;\n}\n#Y3AswkOZPm0qiy2UVZvlZkez\nvar @13_App_Info_3 : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/aisvqsqf\";\n transient = true;\n}\n#bBNxhIal86lYKIvamSdSIjaY\nvar @14_App_Info_4 : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/afpjiooj\";\n transient = true;\n}\n#NzF4EhVGG7woPhmPnliAixIE\nvar @15_Upload_Images : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/fxzfihkw\";\n transient = true;\n}\n#ncULKNvBE2KztzZPCeZpAkDY\nvar @16_Create_Certificate : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/uzxlvvev\";\n transient = true;\n}\n#HvyrGPpdCBgkgany57HRlfeD\nvar @17_iOS_Device : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/luyofzkt\";\n transient = true;\n}\n#jlzt0AP4sDglw23BWlpFGzmL\nvar @18_Product_Archive : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/mnuosfrx\";\n transient = true;\n}\n#ed23hfCPWk4e4wTEwn4QGZzq\nvar Provisioning_Profile : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/jdzxutxx\";\n transient = true;\n}\n#eXePACFUcwQUUlcmdK8BzBgP\nvar P_Validate : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/waeqjhwx\";\n transient = true;\n}\n#lPh2YgYpDFec75cVhrBPJBW7\nvar Distribute : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/evpvthnw\";\n transient = true;\n}\n#n7TK0c4AGeFXhyBY7vYRqXAx\nvar @3_Click_Export_iOS_2 : Picture {\n is\\_resource = true;\n url = \"https://az31353.vo.msecnd.net/pub/przbvosv\";\n transient = true;\n}\n", -"mrgva": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"blank creeper\";\nmeta color \"#ffffffff\";\nmeta rootId \"nHs55hVQebfHsdRXLqdn6Z3u\";\nmeta iconArtId \"yapqobto\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta splitScreen \"yes\";\nmeta platform \"accelerometer,location,musicandsounds,network,orientation,shell\";\nmeta parentIds \"\";\n// Move the creeper to create cool structures! #minecraft #turtle\n#ew46jSsSq5jX27bx\naction main() {\n #C5Nw6Q63PHrMOwzg @\\u267b→creeper→change_block(\"tnt\");\n #GntZkP8LuGenbICm for 0 ≤ i < 100 do {\n #PP9GM4o5xyjrF9bc @\\u267b→creeper→move_forward(5);\n #x17oHSx7q2zlZQpM @\\u267b→creeper→turn_left(90);\n }\n}\n#aEGPr4OxYri200kJ meta import creeper {\n pub \"gwjbc\"\n usage {\n\n action `async` move_forward(blocks: Number)\n action `async` turn_left(angle: Number)\n action `async` turn_right(angle: Number)\n action `async` move_back(blocks: Number)\n action `async` change_block(name: String)\n action `async` fly_down(blocks: Number)\n action `async` fly_up(blocks: Number)\n action `async` position() returns(x: Number, z: Number)\n action `async` fly_mode()\n action `async` build_cube(sides: Number)\n action `async` build_tower(sides: Number, height: Number)\n action `async` wipe_out()\n action `async` mine(blocks: Number)\n action `async` ground_height() returns(y: Number)\n action `async` walk_mode()\n action `async` dig_mode()\n action `async` block() returns(kind: String)\n action `async` chat(msg: String)\n action `async` add_checkpoint(id: String)\n action `async` go_to_checkpoint(id: String)\n action `async` build_walls()\n action `async` change_wool(c: Color)\n }\n #rl3QpY9QnwuqChjo resolve turtle = ♻ turtle with {\n }\n #OC9cODc5n0yv4ONm resolve minecraft_pi = ♻ minecraft_pi with {\n }\n #AzXwvTySoE0bmUJo resolve shell = ♻ shell with {\n }\n}\n#xuKTJPM232PU6f4b meta import turtle {\n pub \"wtmsc\"\n usage {\n type Maze\n\n action `async` pen_down()\n action `async` pen_up()\n action `async` move_to(x: Number, y: Number)\n action `async` forward(steps: Number)\n action `async` left_turn(angle: Number)\n action `async` set_pen_color(c: Color)\n action `async` xcor() returns(x: Number)\n action `async` ycor() returns(y: Number)\n action `async` heading() returns(a: Number)\n action `async` world_width() returns(w: Number)\n action `async` world_height() returns(h: Number)\n action `async` set_heading(angle: Number)\n action `async` set_pen_size(thickness: Number)\n action `async` right_turn(angle: Number)\n action `async` circle(radius: Number)\n action `async` world_board() returns(board: Board)\n action `async` turn_to(dx: Number, dy: Number)\n action `async` world_picture() returns(pic: Picture)\n action `async` set_speed(steps_per_second: Number)\n action `async` go_home()\n action `async` back(steps: Number)\n action `async` pen_size() returns(size: Number)\n action `async` clean()\n action `async` clear_screen()\n action `async` speed() returns(v: Number)\n action `async` set_xy(xcor: Number, ycor: Number)\n action `async` set_x(xcor: Number)\n action `async` set_y(ycor: Number)\n action `async` pen_color() returns(c: Color)\n action `async` color_under() returns(c: Color)\n action `async` save_picture()\n action `async` xy() returns(x: Number, y: Number)\n action `async` touch_xy() returns(tx: Number, ty: Number)\n action `async` show_grid()\n action `async` fast()\n action `async` stamp()\n action `async` set_turtle_picture(pic: Picture)\n action `async` set_turtle_opacity(opacity: Number)\n action `async` trail()\n action `async` add_obstacle(maze: ♻ turtle → Maze, x: Number, y: Number, width: Number, height: Number, c: Color)\n action `async` set_goal(maze: ♻ turtle → Maze, x: Number, y: Number, radius: Number, c: Color)\n action `async` maze() returns(maze: ♻ turtle → Maze)\n action `async` lock(maze: ♻ turtle → Maze)\n action `async` history() returns(commands: String)\n action `async` clear_history()\n action `sync` on_command(command: Text_Action)\n action `async` add_way_point(maze: ♻ turtle → Maze)\n action `async` on_collision(maze: ♻ turtle → Maze, collision: Action)\n action `async` interactive()\n action `async` on_move(@action: Action)\n action `async` set_raster(value: Boolean)\n }\n}\n#JzH9cRaaK3FjH4zq meta import minecraft_pi {\n pub \"eezy\"\n usage {\n type Block_Event\n\n action `async` `type` Block_Event_Action(hit: ♻ minecraft_pi → Block_Event)\n #BVGhpbmca\n table Block_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xNQF2IfWS5kUTCuC state : Number\n // Specifies the color or the id of the whool\n #xUNtn4WzFNh0J275 wool : String\n }\n }\n #xIIDIryL3GdLzzFH\n table Connect_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #IhKVKMjdA949jNr3 host : String\n #PQgsvjixlAlu49Bw port : Number\n #nlMXsJlluWZB1fNN proxy : String\n }\n }\n type Entity\n #umgRs0Idq3y9jRyc\n table Block_Event {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #SCV1txxxrjigP8XC kind : String\n #UIy6UFvY6WJWDDoA x : Number\n #wWASeEjKJDoiqrL2 y : Number\n #MkoIqcTcP3QiIoot z : Number\n #kYCW4sVB0Q5jQy0Q face : Number\n #EayHvTpmMjNF3Sfh entity : ♻ minecraft_pi → Entity\n }\n }\n #pqaWOjEWNqEkbxwJ\n table Position {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #L4NO4JXo2Sev2b1J x : Number\n #x2UU2Lt4BiV8NNNz y : Number\n #gw4VDwinZ6yVcwzL z : Number\n }\n }\n #eVDb6TwJ7CKitS8g\n table Repeat_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Delay in seconds between execution\n #VB0iDf9EazabCCQM delay : Number\n }\n }\n\n action `async` connect(options\\u003f: ♻ minecraft_pi → Connect_Options)\n action `async` set_block(x: Number, y: Number, z: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` set_many_blocks(x: Number, y: Number, z: Number, x2: Number, y2: Number, z2: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` block(x: Number, y: Number, z: Number) returns(name: String)\n action `async` height(x: Number, z: Number) returns(h: Number)\n action `async` chat(msg: String)\n action `async` position(entity: ♻ minecraft_pi → Entity) returns(pos: ♻ minecraft_pi → Position)\n action `async` set_position(entity: ♻ minecraft_pi → Entity, x: Number, y: Number, z: Number)\n action `async` test_commands()\n action `sync` is_connected() returns(r: Boolean)\n action `async` player_() returns(p: ♻ minecraft_pi → Entity)\n action `async` players() returns(players: Collection[ ♻ minecraft_pi → Entity])\n action `async` direction(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` rotation(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` pitch(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` player_by_name(name: String) returns(steve: ♻ minecraft_pi → Entity)\n action `sync` block_names() returns(names: Collection[String])\n action `async` repeat(@action: Action, options\\u003f: ♻ minecraft_pi → Repeat_Options) returns(t: Timer)\n action `sync` wool_colors() returns(cs: Collection[Color])\n action `sync` wool_color(c: Color) returns(name: String)\n action `async` on_hit(@action: ♻ minecraft_pi → Block_Event_Action)\n action `async` spawn(kind: String, x: Number, y: Number, z: Number) returns(mob: ♻ minecraft_pi → Entity)\n action `async` test_spawn()\n }\n #x2P2pI8P142l2Q6f resolve shell = ♻ shell with {\n }\n}\n#xrf8yyBo7axaAgOD meta import shell {\n pub \"qmzn\"\n usage {\n #BdGhpbmca\n table Exec_Output {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #YaaLgMz45N5ZuAeU success : Boolean\n #qrwQiGIhHhUhb8AF error : String\n #ijyQCE4KPQL2ziZD code : Number\n #wf4AkGfhLyWkyKhQ stdout : String\n #ZyLfqXXM99R1znCa stderr : String\n }\n }\n #ttC12C2SJrh1ODjl\n table Serial_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #wXa4BRcG6mdxKU25 delimiter : String\n }\n }\n type Command_Result\n type Shell_Socket\n\n action `async` write_file(path: String, content: String) returns(res: ♻ shell → Command_Result)\n action `sync` mkpath(folder: String, name: String) returns(path: String)\n action `async` mkdir(path: String) returns(res: ♻ shell → Command_Result)\n action `async` exec(cmd: String, cwd: String) returns(res: ♻ shell → Exec_Output)\n action `sync` logger() returns(logger: App_Logger)\n action `async` exec_file(cmd: String, args: Collection[String], cwd: String) returns(res: ♻ shell → Exec_Output)\n action `async` python_env() returns(res: ♻ shell → Command_Result)\n action `async` tcp_connect(host: String, port: Number) returns(sock: ♻ shell → Shell_Socket)\n action `async` receive(sock: ♻ shell → Shell_Socket) returns(netdata: String)\n action `async` send(sock: ♻ shell → Shell_Socket, netdata: String)\n action `async` close(sock: ♻ shell → Shell_Socket)\n action `async` serialport_connect(name: String, options\\u003f: ♻ shell → Serial_Options) returns(sock: ♻ shell → Shell_Socket)\n action `async` serial_list() returns(ports: Json_Object)\n }\n}\n", +"mgufc": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"blank minecraft pi\";\nmeta color \"#ffffffff\";\nmeta rootId \"UqtPMmqsRpLtBLICK3xNRKmo\";\nmeta iconArtId \"eopyzwpm\";\nmeta allowExport \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n#ALKdKR1Vv5Af8ary\naction main() {\n #EzGPnaeUNsf2lJo0 $p := @\\u267b→minecraft_pi→player_→position;\n #VqIjTxbb4k1xKhyn @\\u267b→minecraft_pi→set_many_blocks($p→x, $p→y, $p→z, $p→x + 5, $p→y + 5, $p→z + 5, \"tnt\");\n}\n#hUcA2asY4xnTXGWV meta import minecraft_pi {\n pub \"ihgbe\"\n usage {\n action `async` `type` Block_Event_Action(hit: ♻ minecraft_pi → Block_Event)\n #BVGhpbmca\n table Block_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xNQF2IfWS5kUTCuC state : Number\n // Specifies the color or the id of the whool\n #xUNtn4WzFNh0J275 wool : String\n }\n }\n #xIIDIryL3GdLzzFH\n table Connect_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #IhKVKMjdA949jNr3 host : String\n #PQgsvjixlAlu49Bw port : Number\n #nlMXsJlluWZB1fNN proxy : String\n }\n }\n #umgRs0Idq3y9jRyc\n table Block_Event {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #SCV1txxxrjigP8XC kind : String\n #UIy6UFvY6WJWDDoA x : Number\n #wWASeEjKJDoiqrL2 y : Number\n #MkoIqcTcP3QiIoot z : Number\n #kYCW4sVB0Q5jQy0Q face : Number\n #EayHvTpmMjNF3Sfh entity : ♻ minecraft_pi → Entity\n }\n }\n #pqaWOjEWNqEkbxwJ\n table Position {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #L4NO4JXo2Sev2b1J x : Number\n #x2UU2Lt4BiV8NNNz y : Number\n #gw4VDwinZ6yVcwzL z : Number\n }\n }\n #eVDb6TwJ7CKitS8g\n table Repeat_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Delay in seconds between execution\n #VB0iDf9EazabCCQM delay : Number\n }\n }\n type Entity\n action `async` connect(options\\u003f: ♻ minecraft_pi → Connect_Options)\n action `async` set_block(x: Number, y: Number, z: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` set_many_blocks(x: Number, y: Number, z: Number, x2: Number, y2: Number, z2: Number, name: String, options\\u003f: ♻ minecraft_pi → Block_Options)\n action `async` block(x: Number, y: Number, z: Number) returns(name: String)\n action `async` height(x: Number, z: Number) returns(h: Number)\n action `async` chat(msg: String)\n action `async` position(entity: ♻ minecraft_pi → Entity) returns(pos: ♻ minecraft_pi → Position)\n action `async` set_position(entity: ♻ minecraft_pi → Entity, x: Number, y: Number, z: Number)\n action `async` test_commands()\n action `sync` is_connected() returns(r: Boolean)\n action `async` player_() returns(p: ♻ minecraft_pi → Entity)\n action `async` players() returns(players: Collection[ ♻ minecraft_pi → Entity])\n action `async` direction(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` rotation(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` pitch(entity: ♻ minecraft_pi → Entity) returns(d: Number)\n action `async` player_by_name(name: String) returns(steve: ♻ minecraft_pi → Entity)\n action `sync` block_names() returns(names: Collection[String])\n action `async` repeat(@action: Action, options\\u003f: ♻ minecraft_pi → Repeat_Options) returns(t: Timer)\n action `sync` wool_colors() returns(cs: Collection[Color])\n action `sync` wool_color(c: Color) returns(name: String)\n action `async` on_hit(@action: ♻ minecraft_pi → Block_Event_Action)\n action `async` spawn(kind: String, x: Number, y: Number, z: Number) returns(mob: ♻ minecraft_pi → Entity)\n action `async` test_spawn()\n }\n #pTyF1466i2bg3L5y resolve shell = ♻ shell with {\n }\n}\n#eM2G2nbehvbb7nDd meta import shell {\n pub \"qmzn\"\n usage {\n #BdGhpbmca\n table Exec_Output {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #YaaLgMz45N5ZuAeU success : Boolean\n #qrwQiGIhHhUhb8AF error : String\n #ijyQCE4KPQL2ziZD code : Number\n #wf4AkGfhLyWkyKhQ stdout : String\n #ZyLfqXXM99R1znCa stderr : String\n }\n }\n #ttC12C2SJrh1ODjl\n table Serial_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #wXa4BRcG6mdxKU25 delimiter : String\n }\n }\n type Command_Result\n type Shell_Socket\n action `async` write_file(path: String, content: String) returns(res: ♻ shell → Command_Result)\n action `sync` mkpath(folder: String, name: String) returns(path: String)\n action `async` mkdir(path: String) returns(res: ♻ shell → Command_Result)\n action `async` exec(cmd: String, cwd: String) returns(res: ♻ shell → Exec_Output)\n action `sync` logger() returns(logger: App_Logger)\n action `async` exec_file(cmd: String, args: Collection[String], cwd: String) returns(res: ♻ shell → Exec_Output)\n action `async` python_env() returns(res: ♻ shell → Command_Result)\n action `async` tcp_connect(host: String, port: Number) returns(sock: ♻ shell → Shell_Socket)\n action `async` receive(sock: ♻ shell → Shell_Socket) returns(netdata: String)\n action `async` send(sock: ♻ shell → Shell_Socket, netdata: String)\n action `async` close(sock: ♻ shell → Shell_Socket)\n action `async` serialport_connect(name: String, options\\u003f: ♻ shell → Serial_Options) returns(sock: ♻ shell → Shell_Socket)\n action `async` serial_list() returns(ports: Json_Object)\n }\n}\n", "mzmpa": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"blank event hubs\";\nmeta icon \"Stacks\";\nmeta color \"#ffffffff\";\nmeta rootId \"rTo1i2UE9ZqDVMIBTLAUqMYl\";\nmeta iconArtId \"wyfreugv\";\nmeta isLibrary \"yes\";\nmeta allowExport \"yes\";\nmeta isCloud \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"network,npm,shell\";\nmeta parentIds \"\";\n// A node.js web site that sends events to Azure Event Hubs using AMQP. #node #azure #restify #rest #api\n#x6T4YCsBsZWtPUmF\naction \\_init() {\n #Zy8rc2YHRBIcmnOf // This template allows you to easily stream data to an Azure Event Hubs instance using the AMQP1.0 protocol.\n #LKpR3HLsnUt8zjTC // To setup this service, you will have to setup the following:\n #x0DCfAxIkDRE4kH5 // * An [Event Hub](http://azure.microsoft.com/en-us/services/event-hubs/) in Azure.\n #BPgmHhKMscVJieMa // * define the ``AZURE_SERVICEBUS_SAS_KEY_NAME`` environment variable with your SAS key name\n #R7tTfXVWqjfIjJuw // * define the ``AZURE_SERVICEBUS_SAS_KEY`` environment variable with the SAS key.\n #uHkwReQVwrICaHzH // * (optional) setup application insights instrumentation key by defining the ``APPINSIGHTS_INSTRUMENTATION_KEY`` environment variable.\n #JGUzkYMjc2rxbxQ2 // * `[Export]` this script to a node.js web site.\n #bMtNnag4oaUSbmG8 data→logger := app→create_logger(\"api\");\n #ggtkH2QPjkFSMATl code→init_restify;\n #xYi50zyUUbDrUiYA code→init_azure_services;\n #A3exv4u2E6ZcTY5F data→hub := @\\u267b→sbus_amqp10→create_event_hub_client(\"TODO: service hub namespace\", \"TODO: service hub name\");\n #rlP2tbcbetF1rUVe time→run_every(1, $perform);\n #OVfCshDzbjMrMcel where perform() {\n #wjsvsYZW73p1LRfD // this is where you read your sensor data\n #xViWmNVnfqeTVF3p $msg := records→Message→create;\n #hzLc4iJcGXm7Yk3P $msg→temp := math→random(1000);\n #T9qIzqSC0FK3USRu // and send it to the event hub...\n #NyGUOelE4aFv6HKY data→hub→send_json($msg→to_json);\n #kvai1NC9xIM98v0w where partition_key := data→deviceid;\n }\n}\n#yjW8JMhhkCVxVG9z meta import parallel {\n pub \"fncvb\"\n usage {\n type queue\n action `async` @for(count: Number, @action: Number_Action)\n action `async` for_batched(count: Number, batch_count: Number, item_action: Number_Action, batch_action: Action)\n action `sync` schedule(q: ♻ parallel → queue, task: Action)\n action `sync` create_queue(max_running: Number) returns(queue: ♻ parallel → queue)\n action `async` wait_for_empty(q: ♻ parallel → queue)\n action `async` for_json(js: Json_Object, @action: Json_Action)\n }\n}\n#kGiIbArLBJgrGrUh\nvar logger : App_Logger {\n transient = true;\n}\n#xht4tB8QBEGYhcxd\naction init_azure_services() {\n #zoRhW6H8Xjlu4Nfv @\\u267b→application_insights→init;\n #rIelx44MT4mxwsuP if data→deviceid→is_empty then {\n #lVuKP04Sv0BPFvTe data→deviceid := @\\u267b→node_crypto→random_bytes(16)→to_string(\"hex\");\n }\n #SqiRrk2SBmwfUygc data→logger→info(\"deviceid: \" ∥ data→deviceid);\n meta private;\n}\n#VJhyWCgHgpoXBxQe\naction init_restify() {\n #Rfk2zOUWd63utX0c $server := @\\u267b→restify→server;\n #xwHqz4BboMG6fFYA $server→use(@\\u267b→restify→authorization_parser);\n #CCiEC9MjVyBu1Alm $server→pre(@\\u267b→restify→sanitize_path);\n #QhDtswBtwpK4HWfj $throttle := @\\u267b→restify→throttle;\n #xnNL4UkM1HGz7bML where rate := 40;\n #pjHy3CkNNDrbTRdj where burst := 100;\n #u8A4y4yHMKc8lyUK where ip := true;\n #hivZ6Vt6ftjQnefM $server→use($throttle);\n #xHYwcSAiT7KduHhg $server→use(@\\u267b→restify→CORS);\n #uouNso31DPAdpy0R $server→use(@\\u267b→restify→body_parser);\n #PQsbPK8j0KxXP7BN $server→use(@\\u267b→restify→gzip_response);\n #krhauhLHNWLfS4Rr $server→use(@\\u267b→restify→query_parser);\n #OQV2aOnQMrFwfSMH $server→use(@\\u267b→restify→conditional_request);\n #dJCZRF6m52AEcGvh @\\u267b→restify_touchdevelop→autobind($server);\n #RheHhoSGEfw2gVg7 code→init_routes;\n #JCEJ0pDtVdSmeI23 $server→use(@\\u267b→restify_touchdevelop→errors_to_log(data→logger));\n meta private;\n}\n#FvkNJnD5CXb2RpH7 meta import restify {\n pub \"egzra\"\n usage {\n action `async` `type` Request_Handler(req: ♻ restify → Request, res: ♻ restify → Response)\n #xLPhdjOebDT8w77X\n table Throttle_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xo6LfV0hyAQtz675 rate : Number\n #yZ2QZAfeW3W74JA1 burst : Number\n #JUlNvDq7Hm9cTUAG ip : Boolean\n #w2h4dcf4I5K5h7kn xff : Boolean\n #RO3Sx6iTt4WsVBm6 username : Boolean\n #VbsYnDvr3t4Xr4VA maxKeys : Number\n #w25h9R5LKJnWiBNu tokensTable : ♻ restify → Tokens_Table\n }\n }\n #xdeuBx505IsZ6eEI\n table Serve_Static_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #NfWLVJBBbHvtMqkl default : String\n #KvIMj1sEoAwQCf22 maxAge : Number\n }\n }\n #mqEMUbizkEp6naSD\n table CORS_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xMYYV6C3eS7PWsfQ origins : String\n #z5HdpFdSi792e1OX credentials : Boolean\n #Fw1D0A9ZfeMCf5c3 headers : String\n }\n }\n #w2zTzWkfMf01yOko\n table Body_Parser_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #mhaHCLobgUgMrv72 maxBodySize : Number\n #xr4fKleNd4wHHP1l mapParams : Boolean\n #st0ir2vLTxbLTQWB mapFiles : Boolean\n #z5ah2mZWb8c5FmTM overrideParams : Boolean\n }\n }\n #xv4yZciZi2wFoqpM\n table Send_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #svWYln7UIackFIpB status : Number\n }\n }\n type Request\n type Response\n type Tokens_Table\n type Server\n type Middleware\n type Error\n action `sync` use(server: ♻ restify → Server, mid: ♻ restify → Middleware)\n action `sync` get(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` post(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` server() returns(server: ♻ restify → Server)\n action `sync` send(res: ♻ restify → Response, content: String, options\\u003f: ♻ restify → Send_Options)\n action `sync` status(res: ♻ restify → Response, status: Number)\n action `sync` is(req: ♻ restify → Request, type: String) returns(r: Boolean)\n action `sync` accepts(req: ♻ restify → Request, types: String) returns(type: String)\n action `sync` put(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` del(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` head(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` pre(server: ♻ restify → Server, mid: ♻ restify → Middleware)\n action `sync` CORS(options\\u003f: ♻ restify → CORS_Options) returns(mid: ♻ restify → Middleware)\n action `sync` conditional_request() returns(mid: ♻ restify → Middleware)\n action `sync` route(server: ♻ restify → Server, method: String, path: String, @then: ♻ restify → Request_Handler)\n action `sync` json(res: ♻ restify → Response, content: Json_Object, options\\u003f: ♻ restify → Send_Options)\n action `sync` next(res: ♻ restify → Response)\n action `sync` next_error(res: ♻ restify → Response, error: ♻ restify → Error)\n action `sync` address(server: ♻ restify → Server) returns(address: String)\n action `sync` gzip_response() returns(mid: ♻ restify → Middleware)\n action `sync` header(req: ♻ restify → Request, name: String) returns(value: String)\n action `sync` is_secure(req: ♻ restify → Request) returns(r: Boolean)\n action `sync` is_chunked(req: ♻ restify → Request) returns(r: Boolean)\n action `sync` is_keep_alive(req: ♻ restify → Request) returns(r: Boolean)\n action `sync` set_header(res: ♻ restify → Response, name: String, value: String)\n action `sync` body_parser(options\\u003f: ♻ restify → Body_Parser_Options) returns(mid: ♻ restify → Middleware)\n action `sync` throttle(options\\u003f: ♻ restify → Throttle_Options) returns(middleware: ♻ restify → Middleware)\n action `sync` date_parser(clock_skew: Number) returns(middleware: ♻ restify → Middleware)\n action `sync` serve_static(directory: String, options\\u003f: ♻ restify → Serve_Static_Options) returns(middleware: ♻ restify → Middleware)\n action `sync` query_parser() returns(middleware: ♻ restify → Middleware)\n action `sync` authorization_parser() returns(middleware: ♻ restify → Middleware)\n action `sync` jsonp() returns(middleware: ♻ restify → Middleware)\n action `sync` body_as_json(req: ♻ restify → Request) returns(body: Json_Object)\n action `sync` id(req: ♻ restify → Request) returns(id: String)\n action `sync` param(req: ♻ restify → Request, name: String) returns(value: String)\n action `sync` opts(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` patch(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` to_string(ser: ♻ restify → Server) returns(s: String)\n action `sync` sanitize_path() returns(middleware: ♻ restify → Middleware)\n action `sync` body(req: ♻ restify → Request) returns(body: String)\n action `sync` send_error(res: ♻ restify → Response, status: Number, message: String)\n action `sync` all(server: ♻ restify → Server, @then: ♻ restify → Request_Handler)\n action `sync` method(req: ♻ restify → Request) returns(method: String)\n action `sync` url(req: ♻ restify → Request) returns(url: String)\n action `sync` query(req: ♻ restify → Request) returns(query: Json_Object)\n action `sync` redirect(res: ♻ restify → Response, status_code: Number, url: String)\n action `sync` send_status(res: ♻ restify → Response, status_code: Number)\n action `sync` charset(res: ♻ restify → Response, encoding: String)\n action `sync` route_regex(server: ♻ restify → Server, method: String, path_regex: String, @then: ♻ restify → Request_Handler)\n action `async` read_body_as_buffer(req: ♻ restify → Request) returns(body: Buffer)\n action `sync` headers(req: ♻ restify → Request) returns(headers: Json_Object)\n action `sync` server_url(req: ♻ restify → Request) returns(url: String)\n action `sync` html(res: ♻ restify → Response, content: String, options\\u003f: ♻ restify → Send_Options)\n }\n}\n#A3d3ZvbSo4doxSON meta import restify_touchdevelop {\n pub \"dvuhb\"\n usage {\n action `sync` autobind(server: ♻ restify → Server)\n action `sync` errors_to_log(logger: App_Logger) returns(middleware: ♻ restify → Middleware)\n }\n #Ndi4Jc7GXTkHfWcQ resolve restify = ♻ restify with {\n }\n}\n#rMIDyd4TDaMKCuVx\naction init_routes() {\n #JtHQs8S4PNExhJqH skip;\n meta private;\n}\n#H3dQdzCat87hPU4B meta import node_crypto {\n pub \"ujtrc\"\n usage {\n type credentials\n type hash\n type hmac\n type cipher\n type decipher\n type sign\n type verify\n type DiffieHellman\n action `sync` get_ciphers() returns(ciphers: Collection[String])\n action `sync` get_hashes() returns(hashes: Collection[String])\n action `sync` create_credentials(details: Json_Object) returns(credentials: ♻ node_crypto → credentials)\n action `sync` create_hash(algorithm: String) returns(hash: ♻ node_crypto → hash)\n action `sync` update_hash(hash: ♻ node_crypto → hash, hash_data: Buffer)\n action `sync` digest_hash(hash: ♻ node_crypto → hash) returns(digest: Buffer)\n action `sync` update_hmac(hmac: ♻ node_crypto → hmac, hmac_data: Buffer)\n action `sync` digest_hmac(hmac: ♻ node_crypto → hmac) returns(digest: Buffer)\n action `sync` create_cipher(algorithm: String, password: Buffer) returns(cipher: ♻ node_crypto → cipher)\n action `sync` create_cipher_iv(algorithm: String, key: Buffer, iv: Buffer) returns(iv_cipher: ♻ node_crypto → cipher)\n action `sync` update_cipher(cipher: ♻ node_crypto → cipher, _data: Buffer) returns(enciphered: Buffer)\n action `sync` final(cipher: ♻ node_crypto → cipher) returns(cipher_final: Buffer)\n action `sync` set_auto_padding(cipher: ♻ node_crypto → cipher)\n action `sync` create_decipher(algorithm: String, password: Buffer) returns(decipher: ♻ node_crypto → decipher)\n action `sync` create_decipher_iv(algorithm: String, key: Buffer, iv: Buffer) returns(iv_decipher: ♻ node_crypto → decipher)\n action `sync` update_decipher(decipher: ♻ node_crypto → decipher, _data: Buffer) returns(deciphered: Buffer)\n action `sync` final_(decipher: ♻ node_crypto → decipher) returns(decipher_final: Buffer)\n action `sync` set_auto_padding_(decipher: ♻ node_crypto → decipher)\n action `sync` create_sign(algorithm: String) returns(sign: ♻ node_crypto → sign)\n action `sync` update_sign(sign: ♻ node_crypto → sign, sign\\_data: Buffer)\n action `sync` sign_(sign: ♻ node_crypto → sign, private_key: String) returns(signature: Buffer)\n action `sync` create_verify(algorithm: String) returns(verify: ♻ node_crypto → verify)\n action `sync` update_verify(verify: ♻ node_crypto → verify, verify_data: Buffer)\n action `sync` verify_(verify: ♻ node_crypto → verify, object: String, signature: Buffer) returns(valid: Boolean)\n action `sync` create_DiffieHellman(prime_length: Number) returns(DiffieHellman: ♻ node_crypto → DiffieHellman)\n action `sync` generate_keys(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(public_key: Buffer)\n action `sync` compute_secret(DiffieHellman: ♻ node_crypto → DiffieHellman, other_public_key: Buffer) returns(shared_secret: Buffer)\n action `sync` get_prime(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(DH_prime: Buffer)\n action `sync` get_generator(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(generator: Buffer)\n action `sync` get_public_key(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(public_key: Buffer)\n action `sync` get_private_key(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(private_key: Buffer)\n action `sync` set_public_key(DiffieHellman: ♻ node_crypto → DiffieHellman, public_key: Buffer)\n action `sync` set_private_key(DiffieHellman: ♻ node_crypto → DiffieHellman, private_key: Buffer)\n action `sync` get_DiffieHellman(group_name: String) returns(DiffieHellman: ♻ node_crypto → DiffieHellman)\n action `async` pbkdf2(password: String, salt: String, iterations: Number, keylen: Number) returns(derived_key: String)\n action `async` random_bytes(size: Number) returns(strong_data: Buffer)\n action `sync` DEFAULT\\_ENCODING() returns(default_encoding: String)\n action `sync` create_hmac(algorithm: String, key: String) returns(hmac: ♻ node_crypto → hmac)\n action `sync` create_DiffieHellmanWithPrime(prime: Buffer) returns(DiffieHellman: ♻ node_crypto → DiffieHellman)\n action `async` pseudo_random_bytes(size: Number) returns(non\\u002dstrong_data: Buffer)\n action `sync` update_hash_string(hash: ♻ node_crypto → hash, hash_data: String)\n }\n}\n#lQzkFetSEgRfkoD1\nvar deviceid : String {\n}\n#BVGhpbmca\ntable Message {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #wy6NESQzEaxcVB7P temp : Number\n }\n}\n#j113cC0ZjCAoNnDS meta import node_hash {\n pub \"ezbka\"\n usage {\n action `sync` sha256(value: String) returns(digest: String)\n action `sync` sha1(value: String) returns(digest: String)\n }\n #MBLWOTnilXzcOFAX resolve node_crypto = ♻ node_crypto with {\n }\n}\n#vxXBVxmP2RVFNpVe meta import application_insights {\n pub \"sjdha\"\n usage {\n #BVGhpbmca\n table Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Tracks all uncaught exceptions\n #xYM2DFyGKHO12BbR track_uncaught_exceptions : Boolean\n }\n }\n action `sync` init(options\\u003f: ♻ application_insights → Options) returns(active: Boolean)\n action `sync` track_trace(msg: String)\n action `sync` track_event(name: String)\n action `sync` track_metric(name: String, value: Number)\n action `sync` start_track_event(name: String)\n action `sync` stop_track_event(name: String)\n }\n}\n#xIOpvK4jXnRc4lQH meta import sbus_amqp10 {\n pub \"oygnc\"\n usage {\n #BVGhpbmca\n table Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Shared Access Signature key name\n #fRjSVYac45hTz1IK sas_key_name : String\n // Share Access Signature key\n #tg3cjIf6UbQfP4Qt sas_key : String\n }\n }\n #z4kRkBZXmitv6m0j\n table Send_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // The (optional) partition key is a string that gets set as the partition key for the message (delivered in the message annotations).\n #HKbiDU6YqpuFgNfB partition_key : String\n }\n }\n type Event_Hub_Client\n type Event_Processor\n action `sync` create_event_hub_client(service_hub: String, event_hub: String, options\\u003f: ♻ sbus_amqp10 → Options) returns(hub: ♻ sbus_amqp10 → Event_Hub_Client)\n action `async` send_json(hub: ♻ sbus_amqp10 → Event_Hub_Client, payload: Json_Object, options\\u003f: ♻ sbus_amqp10 → Send_Options)\n action `async` create_event_processor(hub: ♻ sbus_amqp10 → Event_Hub_Client, consumer_group: String) returns(processor: ♻ sbus_amqp10 → Event_Processor)\n action `sync` receive(processor: ♻ sbus_amqp10 → Event_Processor)\n action `async` teardown(processor: ♻ sbus_amqp10 → Event_Processor)\n action `async` send(hub: ♻ sbus_amqp10 → Event_Hub_Client, payload: String, options\\u003f: ♻ sbus_amqp10 → Send_Options)\n }\n}\n#AsaOG4tqpgiEWfI5\nvar hub : ♻ sbus_amqp10 → Event_Hub_Client {\n transient = true;\n}\n", "nehv": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync\";\nmeta name \"game animations\";\nmeta icon \"Controller\";\nmeta color \"#ff9955bb\";\nmeta rootId \"x5GWly5akgFmjLrYRRLK4cEP\";\nmeta isLibrary \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"current\";\nmeta parentIds \"\";\n// A suite of nifty game animations.\n#example\naction example() {\n #oQvXum6wlCxvA14x // This library provides a bunch of cool animation to be used with the `libs->game` library.\n #OrK2keevME4R7Ikt // {hide}\n #IBkRy8dLlysml6xn $pic := media→create_picture(480, 800);\n #LUD4QUQWDq3cZvhL $board := @\\u267b→game→start;\n #PcO7yRSD4Y6NqNK1 @\\u267b→game→bounce_on_sides;\n #uuxlVRt3Fj7zUX3d $sprite := $board→create_rectangle(100, 100);\n #WeOMvS436zFINcmB $sprite→set_color(colors→blue);\n #cd8qQ2IGGEG8LSik $sprite→set_acceleration_y(400);\n #ozsU7Yocpctcf8Kz $sprite→set_opacity(0.8);\n #OTQ8K19QPPnhEckE // {/hide}\n #EBms12UX1I3YptSc // ### splatter\n #o4uCUnbQ4qtH4xOe // Display a splatter under the sprite that goes away after a couple secs.\n #pQPunYKP94mwyJYM code→splatter($sprite, $pic);\n #ItG0lTW3p7NiLMvc // ### add score to a sprite\n #WTbMbwwzr2UNA7NT // Add a score that pops a little ``+score`` on the top right corner of the sprite.\n #Ejn7ZLQa7j8Earpj code→add_score($sprite, 100);\n meta private;\n meta test;\n}\n#MHC9cku1GTEdncGR meta import game {\n pub \"sduub\"\n usage {\n action `sync` set_score(value: Number)\n action `async` set_life(value: Number)\n action `sync` start_timer()\n action `sync` start_countdown_timer(seconds: Number)\n action `sync` life() returns(r: Number)\n action `sync` score() returns(r: Number)\n action `sync` current_time() returns(seconds: Number)\n action `sync` add_score(value: Number)\n action `async` add_life(value: Number)\n action `sync` clear_timer()\n action `async` remove_life(value: Number)\n action `async` end()\n action `async` start() returns(board: Board)\n action `sync` reset()\n action `async` start_with_fixed_size(width: Number, height: Number) returns(board: Board)\n action `async` start_with_background_picture(pic: Picture) returns(board: Board)\n action `sync` board() returns(board: Board)\n action `sync` on_end(@action: Action)\n action `async` splash_text(message: String, seconds: Number, foreground: Color, background: Color, done: Action)\n action `async` start_landscape() returns(board: Board)\n action `async` start_portrait() returns(board: Board)\n action `sync` set_hud_colors(life: Color, timer: Color, score: Color)\n action `sync` hud_sprites() returns(sprites: Sprite_Set)\n action `async` life_visible() returns(b: Boolean)\n action `async` set_life_visible(visible: Boolean)\n action `sync` sprites() returns(sprites: Sprite_Set)\n action `async` set_background_scene(direction: String, pic: Picture)\n action `sync` bounce_on_sides()\n action `sync` create_sprite(pic: Picture) returns(sprite: Sprite)\n }\n}\n#IgJeOaT4qD6XCDWM\naction splatter(#xSZvm6EeJuCvT4s4 sprite: Sprite, #MCvt1zYjYJcK4L44 splatter: Picture) {\n #X4OAdwxnO5wHxDZa // Splats the ``splatter`` picture under the ``sprite`` and fades it away.\n #X64Ps5YYS1av5MpI $sp := @\\u267b→game→board→create_picture($splatter);\n #ODXoYXN95HMQR2Cl $sp→set_pos($sprite→x, $sprite→y);\n #u9qh43UUwoK0FZl0 $sp→set_width($sprite→width);\n #x2LYMGKCfJ1oW8qz $sp→set_speed($sprite→speed_x / 5, $sprite→speed_y / 5);\n #uAJdLNuxiNbu2T4D $sp→friction := 0.05;\n #xkBOKjaSeL4oRcyl $sp→z_index := $sprite→z_index - 1;\n #F7VCHbHecTaVIjT4 $anim := $sp→create_animation;\n #IUYXcNBxhS2fVVRG $anim→puff_out(0.6, \"cubic\", 1.2);\n #bx6onFKBhqu1SI15 $anim→delete;\n}\n#v4ugzdtO8BJPkkj4\naction add_score(#wysUeGszNWAN7trp sprite: Sprite, #tEL2GDgDi86bI72e score: Number) {\n #VeUaeIa25nApnqQT // Shows a little score animation\n #NxnWqSc1zhnO54N9 $bonus := @\\u267b→game→board→create_text(100, 20, 15, $score→to_string);\n #DdGj3W3NCt2n0PVo if $score > 0 then {\n #jIysyn2MjoPyhGQY $bonus→set_text(\"+\" ∥ $bonus→text);\n #dyvGOVwl5E8c2rkE $bonus→set_color(colors→orange);\n }\n else {\n #FMAzDAxm7WBKyVi5 $bonus→set_color(colors→red);\n }\n #VyMLdyfovccmoVPZ $bonus→fit_text;\n #s9mf7tHP4hg6zQrA $bonus→set_pos($sprite→right, $sprite→@top + $bonus→height * 0.6);\n #lU46vyX425TKrBrI $bonus→set_color(colors→green);\n #wGW2fYDAlMw9MmgM @\\u267b→game→add_score($score);\n #trQhQdUjt6fA4cos $anim := $bonus→create_animation;\n #zz6SU1LbMkxhFiv2 $anim→fork→fade_out(1.5, \"linear\");\n #aQP47O58Ny55MN92 $anim→move_to(1.5, \"linear\", \"inout\", $bonus→x, $bonus→y - $sprite→height / 2);\n #IWdqhz1GYoeIezqg $anim→delete;\n meta sync;\n}\n#xkUbqdD2nTGw2md2\naction demo() {\n #nKfBY2pfuGzl6Lqa $pic := media→create_picture(480, 800);\n #umREhXlH6l4zWsW1 $pic→clear(colors→green);\n #c4OOPp4yjrTumwFn $board := @\\u267b→game→start;\n #xC9EjUCuAFD2OizM @\\u267b→game→bounce_on_sides;\n #HTWzkiDs2iFrpskf $sprite := $board→create_rectangle(100, 100);\n #bzn6oVDiFRefDYp2 $sprite→set_color(colors→blue);\n #xYGC7i8OXtlJa6Do $sprite→set_acceleration_y(400);\n #JLsA8cmWdwlhqyVQ $sprite→set_opacity(0.8);\n #r5ErvAs4SbRUQw7y $sprite→on_tap($tapped);\n #ReFgA1ac1h6CUcqH where tapped(x: Number, y: Number) {\n #V34hkhzTxtRXuf22 code→splatter($sprite, $pic);\n #xdmQ7YIokLC3Enu3 code→add_score($sprite, 100);\n }\n meta private;\n meta test;\n}\n", "opqwc": "meta version \"v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex\";\nmeta name \"blank azure web api\";\nmeta icon \"Stacks\";\nmeta color \"#ffffffff\";\nmeta rootId \"x4mibwzdISu8zLeLgg7b3IKt\";\nmeta iconArtId \"wyfreugv\";\nmeta isLibrary \"yes\";\nmeta allowExport \"yes\";\nmeta isCloud \"yes\";\nmeta hasIds \"yes\";\nmeta platform \"network,npm,shell\";\nmeta parentIds \"\";\n// An Azure web api using Restify. #node #azure #restify #rest #api\n#xSBmyyFcqCDRZi1l meta import azure_storage {\n pub \"fwer\"\n usage {\n type @table\n type table_query\n action `async` init()\n action `async` create_private_table_if_not_exists(name: String) returns(@table: ♻ azure_storage → @table)\n action `async` insert_entity(@table: ♻ azure_storage → @table, entity: Json_Object, when_present: String)\n action `async` update_entity(@table: ♻ azure_storage → @table, entity: Json_Object, mode: String)\n action `async` try_update_entity(@table: ♻ azure_storage → @table, entity: Json_Object, mode: String) returns(ok: Boolean)\n action `async` delete_entity(@table: ♻ azure_storage → @table, entity: Json_Object)\n action `sync` create_entity(PartitionKey: String, RowKey: String) returns(entity: Json_Builder)\n action `async` delete_table(@table: ♻ azure_storage → @table)\n action `sync` create_query(@table: ♻ azure_storage → @table) returns(query: ♻ azure_storage → table_query)\n action `sync` @top(query: ♻ azure_storage → table_query, count: Number) returns(res_query: ♻ azure_storage → table_query)\n action `sync` @where(query: ♻ azure_storage → table_query, expression: String, argument: String) returns(res_query: ♻ azure_storage → table_query)\n action `sync` partition_key_is(query: ♻ azure_storage → table_query, PartitionKey: String) returns(res_query: ♻ azure_storage → table_query)\n action `sync` @and(query: ♻ azure_storage → table_query, expression: String, argument: String) returns(res_query: ♻ azure_storage → table_query)\n action `sync` @or(query: ♻ azure_storage → table_query, expression: String, argument: String) returns(res_query: ♻ azure_storage → table_query)\n action `async` get_entity(@table: ♻ azure_storage → @table, PartitionKey: String, RowKey: String) returns(result: Json_Object)\n action `sync` page_size(query: ♻ azure_storage → table_query, count: Number) returns(res_query: ♻ azure_storage → table_query)\n action `async` execute(query: ♻ azure_storage → table_query) returns(entities: Json_Object)\n action `sync` create_log_id() returns(id: String)\n action `sync` create_random_id(size: Number) returns(id: String)\n }\n}\n#czWG9NcXY9uFZHMz\naction \\_init() {\n #bMLhngb94mCl87BE // This action runs when the web server starts up. To deploy this service, go to the script settings, then tap `[Azure]` under `[export to app]`.\n #rg6M5H46J1bK4x8c data→logger := app→create_logger(\"api\");\n #fmCQZR9L4MGzZxju code→init_azure_services;\n #x2Y2gFv2oHeZKjaB code→init_restify;\n}\n#FrNAgtgAKnFVC43t\naction GET_\\u002fping() returns(#aM0QoLDaWxwAlfSy millis: Number) {\n #xzy3cNZXu2Lbz9f2 // Returns the number of milliseconds since epoch.\n #IYDlx4xcyWX5wD4m $millis := time→now→milliseconds_since_epoch;\n}\n#xEtQAQTr2kEKR4Qd meta import azure_search {\n pub \"acqbc\"\n usage {\n type Index_Definition\n type Index\n type Batch_Update\n type Field_Definition\n type Scoring_Profile\n action `async` create_or_update(schema: ♻ azure_search → Index_Definition) returns(index: ♻ azure_search → Index)\n action `sync` create_batch_update(index: ♻ azure_search → Index) returns(update: ♻ azure_search → Batch_Update)\n action `sync` upload(update: ♻ azure_search → Batch_Update, key: String) returns(doc: Json_Builder)\n action `sync` merge(update: ♻ azure_search → Batch_Update, key: String) returns(doc: Json_Builder)\n action `sync` delete(update: ♻ azure_search → Batch_Update, key: String)\n action `async` send(update: ♻ azure_search → Batch_Update) returns(status_code: Number)\n action `async` init(service_name: String, api_key: String, api_version: String)\n action `async` delete_index(index: ♻ azure_search → Index) returns(deleted: Boolean)\n action `async` statistics(index: ♻ azure_search → Index) returns(document_count: Number, storage_size: Number)\n action `sync` action_count(update: ♻ azure_search → Batch_Update) returns(count: Number)\n action `sync` create_index_definition(index_name: String, key_name: String) returns(schema: ♻ azure_search → Index_Definition)\n action `sync` add_field(schema: ♻ azure_search → Index_Definition, name: String, type: String) returns(field: ♻ azure_search → Field_Definition)\n action `sync` set_searchable(field: ♻ azure_search → Field_Definition, value: Boolean)\n action `sync` set_filterable(field: ♻ azure_search → Field_Definition, value: Boolean)\n action `sync` set_sortable(field: ♻ azure_search → Field_Definition, value: Boolean)\n action `sync` set_facetable(field: ♻ azure_search → Field_Definition, value: Boolean)\n action `sync` set_suggestions(field: ♻ azure_search → Field_Definition, value: Boolean)\n action `sync` set_retrievable(field: ♻ azure_search → Field_Definition, value: Boolean)\n action `sync` index_builder(schema: ♻ azure_search → Index_Definition) returns(jsb: Json_Builder)\n action `sync` add_CORS_origin(schema: ♻ azure_search → Index_Definition, origin: String)\n action `sync` update_builder(update: ♻ azure_search → Batch_Update) returns(jsb: Json_Builder)\n action `async` index_definition(index_name: String) returns(schema: Json_Object)\n action `async` indexe_definitions() returns(schema: Json_Object)\n action `sync` add_scoring_profile(index: ♻ azure_search → Index_Definition, name: String) returns(profile: ♻ azure_search → Scoring_Profile)\n action `sync` set_weight(profile: ♻ azure_search → Scoring_Profile, field: ♻ azure_search → Field_Definition, weight: Number)\n action `sync` add_magnitude(profile: ♻ azure_search → Scoring_Profile, field: ♻ azure_search → Field_Definition, boost: Number, interpolation: String, boosting_range_start: Number, boosting_range_end: Number, constant_boost_beyond_range: Boolean)\n action `sync` set_function_aggregation(profile: ♻ azure_search → Scoring_Profile, type: String)\n action `sync` key_field(schema: ♻ azure_search → Index_Definition) returns(key: ♻ azure_search → Field_Definition)\n action `sync` reset(update: ♻ azure_search → Batch_Update)\n action `sync` get(schema: ♻ azure_search → Index_Definition) returns(index: ♻ azure_search → Index)\n }\n}\n#WZspI7jfXbkshSQN meta import azure_service_bus {\n pub \"wbgha\"\n usage {\n #BVGhpbmca\n table Shared_Access_Signature_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Authorization rule name; if empty the ``RootManageSharedAccessKey`` is used\n #LZ3fT92mZud9ADXV key_name : String\n // The ``Primary Key`` associated to the Authorization rule. Leave empty for ``RootManageSharedAccessKey``.\n #Z5xeMrnQRfDYLF4h key : String\n // Expiration in seconds from the current time.\n #l9O44Lv51CRijsGx expires_in : Number\n }\n }\n type Topic\n type Queue\n type Queue_Message\n type Subscription\n action `async` init()\n action `async` create_topic_if_not_exists(name: String) returns(topic: ♻ azure_service_bus → Topic)\n action `async` create_queue_if_not_exists(name: String) returns(queue: ♻ azure_service_bus → Queue)\n action `async` send_message(queue: ♻ azure_service_bus → Queue, message: String)\n action `async` delete_queue(queue: ♻ azure_service_bus → Queue)\n action `async` receive_message(queue: ♻ azure_service_bus → Queue) returns(message: String)\n action `async` peek_message(queue: ♻ azure_service_bus → Queue) returns(message: ♻ azure_service_bus → Queue_Message)\n action `async` delete_message(message: ♻ azure_service_bus → Queue_Message)\n action `sync` content(message: ♻ azure_service_bus → Queue_Message) returns(content: String)\n action `async` delete_topic(topic: ♻ azure_service_bus → Topic)\n action `async` send_topic_message(topic: ♻ azure_service_bus → Topic, message: String)\n action `async` create_subscription(topic: ♻ azure_service_bus → Topic, name: String) returns(subscription: ♻ azure_service_bus → Subscription)\n action `async` delete_subscription(subscription: ♻ azure_service_bus → Subscription)\n action `async` receive_subscription_message(subscription: ♻ azure_service_bus → Subscription) returns(message: String)\n action `sync` create_sas_token(entity_path: String, options\\u003f: ♻ azure_service_bus → Shared_Access_Signature_Options) returns(token: String)\n }\n}\n#GtzZ3bQlwmMy9v5o meta import azure_blob_storage {\n pub \"gajza\"\n usage {\n #eQ9ksqF8mc5ykZ0k\n table Create_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #v2t1qjT74Nc5nEeS etag : String\n #zNv4AFwkrDTt7NE6 force_new : Boolean\n #JEQEgLG1XiOpoNTc just_try : Boolean\n #S4e80DX2Kc4HnE96 contentType : String\n #lqupeQTDrct300uA contentEncoding : String\n #xLEc1tc4MYZOowJi cacheControl : String\n #x7sLNi86uuIjZYsp contentDisposition : String\n }\n }\n type Blob_Service\n type Container\n type Blob_Info\n action `async` init()\n action `sync` create_random_id(size: Number) returns(id: String)\n action `sync` create_blob_service() returns(blob_service: ♻ azure_blob_storage → Blob_Service)\n action `async` create_container_if_not_exists(blob_service: ♻ azure_blob_storage → Blob_Service, container_name: String, permission: String) returns(container: ♻ azure_blob_storage → Container)\n action `async` create_block_blob_from_local_file(container: ♻ azure_blob_storage → Container, blob_name: String, file_path: String) returns(result: ♻ azure_blob_storage → Blob_Info)\n action `async` create_block_blob_from_text(container: ♻ azure_blob_storage → Container, blob_name: String, text: String, options\\u003f: ♻ azure_blob_storage → Create_Options) returns(result: ♻ azure_blob_storage → Blob_Info)\n action `async` get_blob_to_file(container: ♻ azure_blob_storage → Container, blob_name: String, file_path: String) returns(result: ♻ azure_blob_storage → Blob_Info)\n action `async` get_blob_to_text(container: ♻ azure_blob_storage → Container, blob_name: String) returns(info: ♻ azure_blob_storage → Blob_Info)\n action `async` delete_blob(container: ♻ azure_blob_storage → Container, blob_name: String)\n action `async` get_blob_to_buffer(container: ♻ azure_blob_storage → Container, blob_name: String) returns(result: ♻ azure_blob_storage → Blob_Info, buf: Buffer)\n action `async` create_block_blob_from_buffer(container: ♻ azure_blob_storage → Container, blob_name: String, buffer: Buffer, options\\u003f: ♻ azure_blob_storage → Create_Options) returns(result: ♻ azure_blob_storage → Blob_Info)\n action `async` set_service_properties(blob_service: ♻ azure_blob_storage → Blob_Service, properties: Json_Object) returns(result: Json_Object, response: Json_Object)\n action `async` set_cors_properties(blob_service: ♻ azure_blob_storage → Blob_Service, allowed_origins: String, allowed_methods: String, allowed_headers: String, exposed_headers: String, max_age_in_seconds: Number) returns(success: Boolean)\n action `async` service_properties(blob_service: ♻ azure_blob_storage → Blob_Service) returns(result: Json_Object, response: Json_Object)\n action `async` etag(inf: ♻ azure_blob_storage → Blob_Info) returns(etag: String)\n action `async` last_modified(inf: ♻ azure_blob_storage → Blob_Info) returns(lastmod: DateTime)\n action `async` content_md5(inf: ♻ azure_blob_storage → Blob_Info) returns(md5: Buffer)\n action `async` list_blobs(container: ♻ azure_blob_storage → Container, prefix: String) returns(blobs: Collection[ ♻ azure_blob_storage → Blob_Info])\n action `async` name(inf: ♻ azure_blob_storage → Blob_Info) returns(blob_name: String)\n action `sync` get_blob_url(container: ♻ azure_blob_storage → Container, blob_name: String, expires: Number) returns(blob_url: String)\n action `sync` generate_random_id(blob_service: ♻ azure_blob_storage → Blob_Service) returns(id: String)\n action `async` get_blob_properties(container: ♻ azure_blob_storage → Container, blob_name: String) returns(info: ♻ azure_blob_storage → Blob_Info)\n action `async` succeded(inf: ♻ azure_blob_storage → Blob_Info) returns(ok: Boolean)\n action `async` text(inf: ♻ azure_blob_storage → Blob_Info) returns(text: String)\n action `async` error(inf: ♻ azure_blob_storage → Blob_Info) returns(message: String)\n action `async` url(container: ♻ azure_blob_storage → Container) returns(url: String)\n action `async` create_block_blob_from_url(container: ♻ azure_blob_storage → Container, blob_name: String, url: String, options\\u003f: ♻ azure_blob_storage → Create_Options) returns(result: ♻ azure_blob_storage → Blob_Info)\n }\n}\n#a4wL0Lb7xeWxhV4L meta import parallel {\n pub \"fncvb\"\n usage {\n type queue\n action `async` @for(count: Number, @action: Number_Action)\n action `async` for_batched(count: Number, batch_count: Number, item_action: Number_Action, batch_action: Action)\n action `sync` schedule(q: ♻ parallel → queue, task: Action)\n action `sync` create_queue(max_running: Number) returns(queue: ♻ parallel → queue)\n action `async` wait_for_empty(q: ♻ parallel → queue)\n action `async` for_json(js: Json_Object, @action: Json_Action)\n }\n}\n#CW3Wao3uu3Z2Fhe6\nvar logger : App_Logger {\n transient = true;\n}\n#nqXVz0rfKvDDnRD4\naction init_azure_services() {\n #OBj6PIXBqnKUsTPb // Initializes Azure Storage, Azure Blob Storage and Azure Service Bus\n #r8um59444dareUX1 // TODO: setup Application Insights instrumentation key to collect statistics\n #lKXvUpBSfoDB4Fwn @\\u267b→application_insights→init;\n #SefRc2WV2N6j47d4 @\\u267b→azure_storage→init;\n #xEz0G2dzTJTWxcUJ @\\u267b→azure_blob_storage→init;\n #MvPpKEWTfR2lF47o @\\u267b→azure_service_bus→init;\n #x471VF7xAMk2DGHB @\\u267b→azure_event_hubs→init;\n #pNmq2bCUAPLYWZdS where sas_token := @\\u267b→azure_service_bus→create_sas_token(\"\");\n #zudlvXHTv0hhPwyW data→blobs := @\\u267b→azure_blob_storage→create_blob_service;\n meta private;\n}\n#iiySPFknzOIjtFIO\nvar blobs : ♻ azure_blob_storage → Blob_Service {\n transient = true;\n}\n#rmfzWWMIFG8Ule9I\naction init_restify() {\n #GL26xBm2sW9gi51S $server := @\\u267b→restify→server;\n #q44IvFRo4glW35y4 // plugins\n #eq0FvCwwbob1i3UD $server→use(@\\u267b→restify→authorization_parser);\n #Ee6qD4jb4Xr4TCYg $server→pre(@\\u267b→restify→sanitize_path);\n #xiHn2sJ7jyfBOFLf $throttle := @\\u267b→restify→throttle;\n #ZU1qf4WMSwf2ZZs8 where rate := 40;\n #S04R2349FF42Rb2O where burst := 100;\n #qa878gtstkVP7tTO where ip := true;\n #kld3kZpnFcZ4TVhB $server→use($throttle);\n #sptEZCs70xCB68CA $server→use(@\\u267b→restify→CORS);\n #mFFPDO74C64OWH8s $server→use(@\\u267b→restify→body_parser);\n #xSqpOmBEP6L2VCFi $server→use(@\\u267b→restify→gzip_response);\n #xR4QGtRsV3hGoSJQ $server→use(@\\u267b→restify→query_parser);\n #x9bNZzJ9tZk0l1Z4 $server→use(@\\u267b→restify→conditional_request);\n #buXcIfKig0apgL4x @\\u267b→restify_touchdevelop→autobind($server);\n #O8e4in6wAR7ZF8Ke code→init_routes;\n #UAx1DGb27XEqkYO5 $server→use(@\\u267b→restify_touchdevelop→errors_to_log(data→logger));\n meta private;\n}\n#KxDl0eU3LpNWTK07 meta import restify {\n pub \"egzra\"\n usage {\n action `async` `type` Request_Handler(req: ♻ restify → Request, res: ♻ restify → Response)\n #xLPhdjOebDT8w77X\n table Throttle_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xo6LfV0hyAQtz675 rate : Number\n #yZ2QZAfeW3W74JA1 burst : Number\n #JUlNvDq7Hm9cTUAG ip : Boolean\n #w2h4dcf4I5K5h7kn xff : Boolean\n #RO3Sx6iTt4WsVBm6 username : Boolean\n #VbsYnDvr3t4Xr4VA maxKeys : Number\n #w25h9R5LKJnWiBNu tokensTable : ♻ restify → Tokens_Table\n }\n }\n #xdeuBx505IsZ6eEI\n table Serve_Static_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #NfWLVJBBbHvtMqkl default : String\n #KvIMj1sEoAwQCf22 maxAge : Number\n }\n }\n #mqEMUbizkEp6naSD\n table CORS_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #xMYYV6C3eS7PWsfQ origins : String\n #z5HdpFdSi792e1OX credentials : Boolean\n #Fw1D0A9ZfeMCf5c3 headers : String\n }\n }\n #w2zTzWkfMf01yOko\n table Body_Parser_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #mhaHCLobgUgMrv72 maxBodySize : Number\n #xr4fKleNd4wHHP1l mapParams : Boolean\n #st0ir2vLTxbLTQWB mapFiles : Boolean\n #z5ah2mZWb8c5FmTM overrideParams : Boolean\n }\n }\n #xv4yZciZi2wFoqpM\n table Send_Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #svWYln7UIackFIpB status : Number\n }\n }\n type Request\n type Response\n type Tokens_Table\n type Server\n type Middleware\n type Error\n action `sync` use(server: ♻ restify → Server, mid: ♻ restify → Middleware)\n action `sync` get(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` post(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` server() returns(server: ♻ restify → Server)\n action `sync` send(res: ♻ restify → Response, content: String, options\\u003f: ♻ restify → Send_Options)\n action `sync` status(res: ♻ restify → Response, status: Number)\n action `sync` is(req: ♻ restify → Request, type: String) returns(r: Boolean)\n action `sync` accepts(req: ♻ restify → Request, types: String) returns(type: String)\n action `sync` put(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` del(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` head(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` pre(server: ♻ restify → Server, mid: ♻ restify → Middleware)\n action `sync` CORS(options\\u003f: ♻ restify → CORS_Options) returns(mid: ♻ restify → Middleware)\n action `sync` conditional_request() returns(mid: ♻ restify → Middleware)\n action `sync` route(server: ♻ restify → Server, method: String, path: String, @then: ♻ restify → Request_Handler)\n action `sync` json(res: ♻ restify → Response, content: Json_Object, options\\u003f: ♻ restify → Send_Options)\n action `sync` next(res: ♻ restify → Response)\n action `sync` next_error(res: ♻ restify → Response, error: ♻ restify → Error)\n action `sync` address(server: ♻ restify → Server) returns(address: String)\n action `sync` gzip_response() returns(mid: ♻ restify → Middleware)\n action `sync` header(req: ♻ restify → Request, name: String) returns(value: String)\n action `sync` is_secure(req: ♻ restify → Request) returns(r: Boolean)\n action `sync` is_chunked(req: ♻ restify → Request) returns(r: Boolean)\n action `sync` is_keep_alive(req: ♻ restify → Request) returns(r: Boolean)\n action `sync` set_header(res: ♻ restify → Response, name: String, value: String)\n action `sync` body_parser(options\\u003f: ♻ restify → Body_Parser_Options) returns(mid: ♻ restify → Middleware)\n action `sync` throttle(options\\u003f: ♻ restify → Throttle_Options) returns(middleware: ♻ restify → Middleware)\n action `sync` date_parser(clock_skew: Number) returns(middleware: ♻ restify → Middleware)\n action `sync` serve_static(directory: String, options\\u003f: ♻ restify → Serve_Static_Options) returns(middleware: ♻ restify → Middleware)\n action `sync` query_parser() returns(middleware: ♻ restify → Middleware)\n action `sync` authorization_parser() returns(middleware: ♻ restify → Middleware)\n action `sync` jsonp() returns(middleware: ♻ restify → Middleware)\n action `sync` body_as_json(req: ♻ restify → Request) returns(body: Json_Object)\n action `sync` id(req: ♻ restify → Request) returns(id: String)\n action `sync` param(req: ♻ restify → Request, name: String) returns(value: String)\n action `sync` opts(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` patch(server: ♻ restify → Server, path: String, @then: ♻ restify → Request_Handler)\n action `sync` to_string(ser: ♻ restify → Server) returns(s: String)\n action `sync` sanitize_path() returns(middleware: ♻ restify → Middleware)\n action `sync` body(req: ♻ restify → Request) returns(body: String)\n action `sync` send_error(res: ♻ restify → Response, status: Number, message: String)\n action `sync` all(server: ♻ restify → Server, @then: ♻ restify → Request_Handler)\n action `sync` method(req: ♻ restify → Request) returns(method: String)\n action `sync` url(req: ♻ restify → Request) returns(url: String)\n action `sync` query(req: ♻ restify → Request) returns(query: Json_Object)\n action `sync` redirect(res: ♻ restify → Response, status_code: Number, url: String)\n action `sync` send_status(res: ♻ restify → Response, status_code: Number)\n action `sync` charset(res: ♻ restify → Response, encoding: String)\n action `sync` route_regex(server: ♻ restify → Server, method: String, path_regex: String, @then: ♻ restify → Request_Handler)\n action `async` read_body_as_buffer(req: ♻ restify → Request) returns(body: Buffer)\n action `sync` headers(req: ♻ restify → Request) returns(headers: Json_Object)\n action `sync` server_url(req: ♻ restify → Request) returns(url: String)\n action `sync` html(res: ♻ restify → Response, content: String, options\\u003f: ♻ restify → Send_Options)\n }\n}\n#MLbRHC7j0u4Bo4GQ meta import restify_touchdevelop {\n pub \"dvuhb\"\n usage {\n action `sync` autobind(server: ♻ restify → Server)\n action `sync` errors_to_log(logger: App_Logger) returns(middleware: ♻ restify → Middleware)\n }\n #OzaDw2jYXC1r4oMK resolve restify = ♻ restify with {\n }\n}\n#xHPXd7nOkAZ4A4vr meta import azure_event_hubs {\n pub \"wvdr\"\n usage {\n #qy4yPchAE7AUedlB\n table Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Name of the event hub\n #BULIHveLGv3xhPGc hub_namespace : String\n // Shared Access Signature token; otherwise the server setting ``AZURE_SERVICEBUS_SAS_TOKEN`` is used.\n #xr7jIhKzmCpq0i5N sas_token : String\n }\n }\n #EyRHf2UILCkoocED\n table Event_Hub {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n #t4VjI1BVPLvcUl22 name : String\n }\n }\n action `sync` init(options\\u003f: ♻ azure_event_hubs → Options)\n action `async` send_message(hub: ♻ azure_event_hubs → Event_Hub, device_id: String, msg: String) returns(status: Number)\n action `async` create_event_hub_if_not_exists(name_: String) returns(hub: ♻ azure_event_hubs → Event_Hub)\n action `async` send_message_as_json(hub: ♻ azure_event_hubs → Event_Hub, device_id: String, msg: Json_Object) returns(status: Number)\n }\n}\n#xcDhCtrxPsQBOdut\naction init_routes() {\n #f2p7glhNykvLLVg0 // TODO: add custom routes here\n #xLyImlUfp28hk6Pb $server := @\\u267b→restify→server;\n #B2Ui2S2BrMhefyH4 $server→get(\"/echo\", $@then);\n #c58sWTLqXwkWaboA where @then(req: ♻ restify → Request, res: ♻ restify → Response) {\n #yXsNFxumA3UsfrbL $res→send($req→body);\n }\n meta private;\n}\n#xZ4HxLh7nvC9Ye4O meta import node_hash {\n pub \"ezbka\"\n usage {\n action `sync` sha256(value: String) returns(digest: String)\n action `sync` sha1(value: String) returns(digest: String)\n }\n #xLAq93oXbklxTC8e resolve node_crypto = ♻ node_crypto with {\n }\n}\n#nXJ5d37Qe8izPDXw meta import node_crypto {\n pub \"ujtrc\"\n usage {\n type credentials\n type hash\n type hmac\n type cipher\n type decipher\n type sign\n type verify\n type DiffieHellman\n action `sync` get_ciphers() returns(ciphers: Collection[String])\n action `sync` get_hashes() returns(hashes: Collection[String])\n action `sync` create_credentials(details: Json_Object) returns(credentials: ♻ node_crypto → credentials)\n action `sync` create_hash(algorithm: String) returns(hash: ♻ node_crypto → hash)\n action `sync` update_hash(hash: ♻ node_crypto → hash, hash_data: Buffer)\n action `sync` digest_hash(hash: ♻ node_crypto → hash) returns(digest: Buffer)\n action `sync` update_hmac(hmac: ♻ node_crypto → hmac, hmac_data: Buffer)\n action `sync` digest_hmac(hmac: ♻ node_crypto → hmac) returns(digest: Buffer)\n action `sync` create_cipher(algorithm: String, password: Buffer) returns(cipher: ♻ node_crypto → cipher)\n action `sync` create_cipher_iv(algorithm: String, key: Buffer, iv: Buffer) returns(iv_cipher: ♻ node_crypto → cipher)\n action `sync` update_cipher(cipher: ♻ node_crypto → cipher, _data: Buffer) returns(enciphered: Buffer)\n action `sync` final(cipher: ♻ node_crypto → cipher) returns(cipher_final: Buffer)\n action `sync` set_auto_padding(cipher: ♻ node_crypto → cipher)\n action `sync` create_decipher(algorithm: String, password: Buffer) returns(decipher: ♻ node_crypto → decipher)\n action `sync` create_decipher_iv(algorithm: String, key: Buffer, iv: Buffer) returns(iv_decipher: ♻ node_crypto → decipher)\n action `sync` update_decipher(decipher: ♻ node_crypto → decipher, _data: Buffer) returns(deciphered: Buffer)\n action `sync` final_(decipher: ♻ node_crypto → decipher) returns(decipher_final: Buffer)\n action `sync` set_auto_padding_(decipher: ♻ node_crypto → decipher)\n action `sync` create_sign(algorithm: String) returns(sign: ♻ node_crypto → sign)\n action `sync` update_sign(sign: ♻ node_crypto → sign, sign\\_data: Buffer)\n action `sync` sign_(sign: ♻ node_crypto → sign, private_key: String) returns(signature: Buffer)\n action `sync` create_verify(algorithm: String) returns(verify: ♻ node_crypto → verify)\n action `sync` update_verify(verify: ♻ node_crypto → verify, verify_data: Buffer)\n action `sync` verify_(verify: ♻ node_crypto → verify, object: String, signature: Buffer) returns(valid: Boolean)\n action `sync` create_DiffieHellman(prime_length: Number) returns(DiffieHellman: ♻ node_crypto → DiffieHellman)\n action `sync` generate_keys(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(public_key: Buffer)\n action `sync` compute_secret(DiffieHellman: ♻ node_crypto → DiffieHellman, other_public_key: Buffer) returns(shared_secret: Buffer)\n action `sync` get_prime(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(DH_prime: Buffer)\n action `sync` get_generator(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(generator: Buffer)\n action `sync` get_public_key(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(public_key: Buffer)\n action `sync` get_private_key(DiffieHellman: ♻ node_crypto → DiffieHellman) returns(private_key: Buffer)\n action `sync` set_public_key(DiffieHellman: ♻ node_crypto → DiffieHellman, public_key: Buffer)\n action `sync` set_private_key(DiffieHellman: ♻ node_crypto → DiffieHellman, private_key: Buffer)\n action `sync` get_DiffieHellman(group_name: String) returns(DiffieHellman: ♻ node_crypto → DiffieHellman)\n action `async` pbkdf2(password: String, salt: String, iterations: Number, keylen: Number) returns(derived_key: String)\n action `async` random_bytes(size: Number) returns(strong_data: Buffer)\n action `sync` DEFAULT\\_ENCODING() returns(default_encoding: String)\n action `sync` create_hmac(algorithm: String, key: String) returns(hmac: ♻ node_crypto → hmac)\n action `sync` create_DiffieHellmanWithPrime(prime: Buffer) returns(DiffieHellman: ♻ node_crypto → DiffieHellman)\n action `async` pseudo_random_bytes(size: Number) returns(non\\u002dstrong_data: Buffer)\n action `sync` update_hash_string(hash: ♻ node_crypto → hash, hash_data: String)\n }\n}\n#xxBeCJozPqG4dvGB meta import application_insights {\n pub \"sjdha\"\n usage {\n #BVGhpbmca\n table Options {\n type = \"Object\";\n exported = true;\n persistent = false;\n fields {\n // Tracks all uncaught exceptions\n #xYM2DFyGKHO12BbR track_uncaught_exceptions : Boolean\n }\n }\n action `sync` init(options\\u003f: ♻ application_insights → Options) returns(active: Boolean)\n action `sync` track_trace(msg: String)\n action `sync` track_event(name: String)\n action `sync` track_metric(name: String, value: Number)\n action `sync` start_track_event(name: String)\n action `sync` stop_track_event(name: String)\n }\n}\n", @@ -370,8 +370,8 @@ {"title":"blank turtle","id":"blankturtle","icon":"Controller","name":"ADJ turtle","description":"An turtle app.","section":"beginners","scriptid":"parp","editorMode":1}, {"title":"blank scratch","id":"blankscratch","icon":"Controller","name":"ADJ app","description":"An empty app using the scratch library.","section":"beginners","scriptid":"enyra","editorMode":1}, {"title":"blank pixel art","id":"blankpixelart","icon":"NineColumn","name":"ADJ art","description":"A pixel art app.","section":"beginners","scriptid":"mdrw","editorMode":1}, -{"title":"blank minecraft pi","id":"blankminecraftpi","icon":"NineColumn","name":"ADJ craft","description":"A Minecraft Pi app.","section":"Minecraft","scriptid":"kdwc","editorMode":1}, -{"title":"blank creeper","id":"blankcreeper","icon":"NineColumn","name":"ADJ creeper","description":"A Minecraft creeper app.","section":"Minecraft","scriptid":"mrgva","editorMode":1}, +{"title":"blank minecraft pi","id":"blankminecraftpi","icon":"NineColumn","name":"ADJ craft","description":"A Minecraft Pi app.","section":"Minecraft","scriptid":"mgufc","editorMode":1}, +{"title":"blank creeper","id":"blankcreeper","icon":"NineColumn","name":"ADJ creeper","description":"A Minecraft creeper app.","section":"Minecraft","scriptid":"gufle","editorMode":1}, {"title":"blank cordova library","id":"blankcordovalibrary","icon":"ApproveButton","name":"cordova ADJ plugin","description":"An wrapper around an Apache Cordova plugin.","section":"apps","scriptid":"gtfla","editorMode":3}, {"title":"blank web app","id":"blankwebapi","icon":"Stacks","name":"ADJ api","description":"A web app using Node.js and Restify.","section":"web apps","scriptid":"cleva","editorMode":3}, {"title":"blank azure web app","id":"blankazurewebapi","icon":"Stacks","name":"azure ADJ api","description":"A web app using Azure Services, Node.js and Restify.","section":"web apps","scriptid":"opqwc","editorMode":3}, diff --git a/lib/App.ts b/lib/App.ts index 3e69556f..a47eff66 100644 --- a/lib/App.ts +++ b/lib/App.ts @@ -300,7 +300,7 @@ module TDev.RT { //? Indicates if the `app->host_exec` action can be used to run host commands. //@ betaOnly public has_host(): boolean { - return !!(window).mcefQuery || !!(window).touchDevelopExec; + return Browser.isHosted; } //? Where are we running from: "editor", "website", "nodejs", "mobileapp", "plugin" @@ -712,39 +712,44 @@ module TDev.RT { return r } + export function hostExecAsync(message: string): Promise { + return new Promise((onSuccess, onError, onProgress) => { + var mcefQuery = (window).mcefQuery; + if (mcefQuery) { + mcefQuery({ + request: message, + persistent: false, + onSuccess: function (response) { + onSuccess(response); + }, + onFailure: function (error_code, error_message) { + onSuccess(JSON.stringify({ error: error_code, message: error_message })); + } + }); + return; + } + + var exec = (window).touchDevelopExec; + if (!exec) { + App.log("window.touchDevelopExec function not defined"); + onSuccess(undefined); + return; + } + + try { + exec(message,(result) => { onSuccess(result); }); + } + catch (e) { + App.logEvent(App.DEBUG, "app", "touchDevelopExec failed", undefined); + onSuccess(undefined); + } + }); + } //? Invokes the host to execute a command described in the message and returns the response. There is no restriction on the format of the request and response. If not available or errored, returns invalid. //@ async readsMutable returns(string) betaOnly export function host_exec(message: string, r: ResumeCtx) { - var mcefQuery = (window).mcefQuery; - if (mcefQuery) { - mcefQuery({ - request: message, - persistent: false, - onSuccess: function (response) { - r.resumeVal(response); - }, - onFailure: function (error_code, error_message) { - r.resumeVal(JSON.stringify({ error: error_code, message: error_message })); - } - }); - return; - } - - var exec = (window).touchDevelopExec; - if (!exec) { - App.log("window.touchDevelopExec function not defined"); - r.resumeVal(undefined); - return; - } - - try { - exec(message, (result) => { r.resumeVal(result); }); - } - catch (e) { - App.logEvent(App.DEBUG, "app", "touchDevelopExec failed", undefined); - r.resumeVal(undefined); - } + return hostExecAsync(message).done(resp => r.resumeVal(resp)); } } } diff --git a/lib/Wall.ts b/lib/Wall.ts index 8b55d357..55bc69e5 100644 --- a/lib/Wall.ts +++ b/lib/Wall.ts @@ -470,6 +470,19 @@ module TDev.RT { export module ScreenshotManager { export var toScreenshotURLAsync = (rt: RuntimeHost): Promise => { // string { + // TODO: move somewhere else + if (App.env().has_host()) { + var durl: string; + return App.hostExecAsync("screen.min") + .then(() => new Promise((onSuccess, onError, onProcess) => { + Util.setTimeout(100,() => onSuccess(undefined)); + })).then(() => App.hostExecAsync("screen.screenshot")) + .then((url) => { + durl = url; + return App.hostExecAsync("screen.show"); + }).then(() => durl); + } + var c = rt.toScreenshotCanvas(); try { var data = c ? c.toDataURL('image/png') : undefined;