Tilde Friends client-side browser JavaScript.
◆ _receive_websocket_message()
| function _receive_websocket_message |
( |
|
message | ) |
|
Process an incoming WebSocket message.
- Parameters
-
◆ api_error()
| function api_error |
( |
|
error | ) |
|
Show an error.
- Parameters
-
◆ api_localStorageGet()
| function api_localStorageGet |
( |
|
key | ) |
|
Get a value from local storage.
- Parameters
-
- Returns
- The value.
◆ api_localStorageSet()
| function api_localStorageSet |
( |
|
key, |
|
|
|
value |
|
) |
| |
et a value in local storage.
- Parameters
-
| key | The key. |
| value | The value. |
◆ api_postMessage()
| function api_postMessage |
( |
|
message | ) |
|
Send a message to the sandboxed iframe.
- Parameters
-
◆ api_print()
Log from the app to the console.
◆ api_requestPermission()
| function api_requestPermission |
( |
|
permission, |
|
|
|
description |
|
) |
| |
Request a permission
- Parameters
-
| permission | The permission to request. |
| description | An optional human-readable description of the action for which the permission is being requested. |
- Returns
- A promise fulfilled if the permission was granted.
◆ api_setDocument()
| function api_setDocument |
( |
|
content | ) |
|
Set the iframe document contents.
- Parameters
-
◆ api_setHash()
| function api_setHash |
( |
|
hash | ) |
|
Set the window's location hash.
- Parameters
-
◆ appExport()
| function async appExport |
( |
| ) |
|
Export the app to a zip file, which is downloaded by the browser.
◆ appImport()
| function async appImport |
( |
| ) |
|
Prompt to import an app from a zip file.
◆ blur()
Notify the app of lost focus.
◆ changeIcon()
Prompt to set the app icon.
◆ closeEditor()
◆ connectSocket()
| function connectSocket |
( |
|
path | ) |
|
Connect the WebSocket.
- Parameters
-
| path | The path to which to connect. |
◆ deleteApp()
Prompt to delete the current app.
◆ edit()
◆ editing()
Check whether the editior is currently visible.
- Returns
- true if the editor is visible.
◆ ensureLoaded()
| function ensureLoaded |
( |
|
nodes, |
|
|
|
callback |
|
) |
| |
Make sure a set of dependencies are loaded
- Parameters
-
| nodes | An array of descriptions of dependencies to load. |
| callback | Called when all dependencies are loaded. |
◆ focus()
Make sure the app is connected on window focus, and notify the app.
◆ hash()
Get the window hash without the lone '#' if it is empty.
- Returns
- The hash.
◆ hashChange()
Notify the app of the window hash changing.
◆ is_edit_only()
| function is_edit_only |
( |
| ) |
|
Check whether only the editor is visible and the app is hidden.
- Returns
- true if the editor is visible and the app is not.
◆ load()
| function async load |
( |
|
path | ) |
|
Load files for the app.
- Parameters
-
| path | The app path to load. |
- Returns
- A promise resolved when the app is laoded.
◆ loadFile()
| function loadFile |
( |
|
name, |
|
|
|
id |
|
) |
| |
Load a single file.
- Parameters
-
| name | The name by which the file is known. |
| id | The file's ID. |
- Returns
- A promise resolved with the file's contents.
◆ makeNewFile()
| function makeNewFile |
( |
|
name | ) |
|
Create a new file with the given name.
- Parameters
-
◆ message()
| function message |
( |
|
event | ) |
|
Handle a message.
- Parameters
-
◆ modeFromName()
| function modeFromName |
( |
|
name | ) |
|
Determine a CodeMirror language mode from filename.
- Parameters
-
- Returns
- The mode name.
◆ newFile()
Prompt to create a new file.
◆ openFile()
| function openFile |
( |
|
name | ) |
|
Open a file by name.
- Parameters
-
◆ reconnect()
| function reconnect |
( |
|
path | ) |
|
Reconnect the WebSocket.
- Parameters
-
| path | The path to which the WebSocket should be connected. |
◆ removeFile()
◆ save()
Save the app.
- Parameters
-
| save_to | An optional path to which to save the app. |
- Returns
- A promise resoled when the app is saved.
◆ save_file_to_blob_id()
| function async save_file_to_blob_id |
( |
|
name, |
|
|
|
file |
|
) |
| |
Save a file.
- Parameters
-
| name | The file to svae. |
| file | The file contents. |
- Returns
- A promise resolved with the blob ID of the saved file.
◆ send()
Send a message to the app.
- Parameters
-
◆ setStatusMessage()
| function setStatusMessage |
( |
|
message, |
|
|
|
color |
|
) |
| |
Set the status message.
- Parameters
-
| message | The message. |
| color | The message's color. |
◆ sourcePretty()
| function async sourcePretty |
( |
| ) |
|
Prettify the current source file.
◆ toggleVisibleWhitespace()
| function toggleVisibleWhitespace |
( |
| ) |
|
Toggle visible whitespace.
◆ trace()
Open a performance trace.
◆ update_html()
| function async update_html |
( |
| ) |
|
Reload any static HTML content in the iframe.
◆ updateFiles()
◆ url()
Get the current app URL.
- Returns
- The app URL.
◆ visibilitychange()
| function visibilitychange |
( |
| ) |
|
Notify the app of visibility change. Seems to work when changing apps/tabs where focus/blur doesn't on mobile.
◆ k_api
Initial value:= {
requestPermission: {
args: ['permission', 'id', 'description'],
},
}
function api_localStorageGet(key)
Definition client.js:1297
function api_error(error)
Definition client.js:1269
function api_setHash(hash)
Definition client.js:1396
function api_postMessage(message)
Definition client.js:1260
function api_setDocument(content)
Definition client.js:1251
function api_print()
Definition client.js:1388
function api_localStorageSet(key, value)
Definition client.js:1288
function api_requestPermission(permission, description)
Definition client.js:1307
Functions that server-side app code can call through the app object.