docs: Fix all the TODOCS. #39
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m17s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m17s
This commit is contained in:
125
core/client.js
125
core/client.js
@@ -72,7 +72,7 @@ class TfNavigationElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Toggle editor visibility.
|
||||
* @param event The HTML event.
|
||||
*/
|
||||
toggle_edit(event) {
|
||||
@@ -85,7 +85,7 @@ class TfNavigationElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Remove a stored permission.
|
||||
* @param key The permission to reset.
|
||||
*/
|
||||
reset_permission(key) {
|
||||
@@ -93,7 +93,7 @@ class TfNavigationElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Get or create a spark line.
|
||||
* @param key The spark line identifier.
|
||||
* @param options Spark line options.
|
||||
* @return A spark line HTML element.
|
||||
@@ -262,8 +262,8 @@ class TfNavigationElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Render the permissions popup.
|
||||
* @return Lit HTML.
|
||||
*/
|
||||
render_permissions() {
|
||||
if (this.show_permissions) {
|
||||
@@ -312,8 +312,8 @@ class TfNavigationElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Render the navigation bar.
|
||||
* @return Lit HTML.
|
||||
*/
|
||||
render() {
|
||||
let self = this;
|
||||
@@ -441,7 +441,7 @@ class TfNavigationElement extends LitElement {
|
||||
customElements.define('tf-navigation', TfNavigationElement);
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* A file in the files sidebar.
|
||||
*/
|
||||
class TfFilesElement extends LitElement {
|
||||
/**
|
||||
@@ -467,7 +467,7 @@ class TfFilesElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Select a clicked file.
|
||||
* @param file The file.
|
||||
*/
|
||||
file_click(file) {
|
||||
@@ -483,9 +483,9 @@ class TfFilesElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Render a single file in the file list.
|
||||
* @param file The file.
|
||||
* @returns Lit HTML.
|
||||
* @return Lit HTML.
|
||||
*/
|
||||
render_file(file) {
|
||||
let classes = ['file'];
|
||||
@@ -507,7 +507,7 @@ class TfFilesElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Create a file entry for a dropped file.
|
||||
* @param event The event.
|
||||
*/
|
||||
async drop(event) {
|
||||
@@ -533,7 +533,7 @@ class TfFilesElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Called when a file starts being dragged over the file.
|
||||
* @param event The event.
|
||||
*/
|
||||
drag_enter(event) {
|
||||
@@ -543,7 +543,7 @@ class TfFilesElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Called when a file stops being dragged over the file.
|
||||
* @param event The event.
|
||||
*/
|
||||
drag_leave(event) {
|
||||
@@ -554,7 +554,7 @@ class TfFilesElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* Drag over event.
|
||||
* Called when a file is being dragged over the file.
|
||||
* @param event The event.
|
||||
*/
|
||||
drag_over(event) {
|
||||
@@ -562,8 +562,8 @@ class TfFilesElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Render the file.
|
||||
* @return Lit HTML.
|
||||
*/
|
||||
render() {
|
||||
let self = this;
|
||||
@@ -610,7 +610,7 @@ class TfFilesElement extends LitElement {
|
||||
customElements.define('tf-files', TfFilesElement);
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* The files pane element.
|
||||
*/
|
||||
class TfFilesPaneElement extends LitElement {
|
||||
/**
|
||||
@@ -635,7 +635,7 @@ class TfFilesPaneElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Set whether the files pane is expanded.
|
||||
* @param expanded Whether the files pane is expanded.
|
||||
*/
|
||||
set_expanded(expanded) {
|
||||
@@ -644,8 +644,8 @@ class TfFilesPaneElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Render the files pane element.
|
||||
* @return Lit HTML.
|
||||
*/
|
||||
render() {
|
||||
let self = this;
|
||||
@@ -704,7 +704,7 @@ class TfFilesPaneElement extends LitElement {
|
||||
customElements.define('tf-files-pane', TfFilesPaneElement);
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* A tiny graph.
|
||||
*/
|
||||
class TfSparkLineElement extends LitElement {
|
||||
static get properties() {
|
||||
@@ -724,9 +724,9 @@ class TfSparkLineElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @param {*} key
|
||||
* @param {*} value
|
||||
* Add a data point to the graph.
|
||||
* @param key The line to which the point applies.
|
||||
* @param value The numeric value of the data point.
|
||||
*/
|
||||
append(key, value) {
|
||||
let line = null;
|
||||
@@ -753,9 +753,9 @@ class TfSparkLineElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @param {*} line
|
||||
* @returns
|
||||
* Render a single series line.
|
||||
* @param line The line data.
|
||||
* @return Lit HTML.
|
||||
*/
|
||||
render_line(line) {
|
||||
if (line?.values?.length >= 2) {
|
||||
@@ -771,8 +771,8 @@ class TfSparkLineElement extends LitElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Render the graph.
|
||||
* @return Lit HTML.
|
||||
*/
|
||||
render() {
|
||||
let max =
|
||||
@@ -799,7 +799,9 @@ class TfSparkLineElement extends LitElement {
|
||||
|
||||
customElements.define('tf-sparkline', TfSparkLineElement);
|
||||
|
||||
// TODOC
|
||||
/**
|
||||
* A keyboard key is pressed down.
|
||||
*/
|
||||
window.addEventListener('keydown', function (event) {
|
||||
if (event.keyCode == 83 && (event.altKey || event.ctrlKey)) {
|
||||
if (editing()) {
|
||||
@@ -860,24 +862,23 @@ function ensureLoaded(nodes, callback) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Check whether the editior is currently visible.
|
||||
* @return true if the editor is visible.
|
||||
*/
|
||||
function editing() {
|
||||
return document.getElementById('editPane').style.display != 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Check whether only the editor is visible and the app is hidden.
|
||||
* @return true if the editor is visible and the app is not.
|
||||
*/
|
||||
function is_edit_only() {
|
||||
return window.location.search == '?editonly=1' || window.innerWidth < 1024;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Show the editor.
|
||||
*/
|
||||
async function edit() {
|
||||
if (editing()) {
|
||||
@@ -904,7 +905,7 @@ async function edit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Open a performance trace.
|
||||
*/
|
||||
function trace() {
|
||||
window.open(`/speedscope/#profileURL=${encodeURIComponent('/trace')}`);
|
||||
@@ -982,7 +983,7 @@ async function load(path) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Hide the editor.
|
||||
*/
|
||||
function closeEditor() {
|
||||
window.localStorage.setItem('editing', '0');
|
||||
@@ -990,14 +991,6 @@ function closeEditor() {
|
||||
document.getElementById('viewPane').style.display = 'flex';
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
*/
|
||||
function explodePath() {
|
||||
return /^\/~([^\/]+)\/([^\/]+)(.*)/.exec(window.location.pathname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the app.
|
||||
* @param save_to An optional path to which to save the app.
|
||||
@@ -1111,7 +1104,7 @@ function save(save_to) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Prompt to set the app icon.
|
||||
*/
|
||||
function changeIcon() {
|
||||
let value = prompt('Enter a new app icon emoji:');
|
||||
@@ -1122,7 +1115,7 @@ function changeIcon() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Prompt to delete the current app.
|
||||
*/
|
||||
function deleteApp() {
|
||||
let name = document.getElementById('name');
|
||||
@@ -1143,8 +1136,8 @@ function deleteApp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Get the current app URL.
|
||||
* @return The app URL.
|
||||
*/
|
||||
function url() {
|
||||
let hash = window.location.href.indexOf('#');
|
||||
@@ -1162,8 +1155,8 @@ function url() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
* Get the window hash without the lone '#' if it is empty.
|
||||
* @return The hash.
|
||||
*/
|
||||
function hash() {
|
||||
return window.location.hash != '#' ? window.location.hash : '';
|
||||
@@ -1188,7 +1181,7 @@ function api_postMessage(message) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Show an error.
|
||||
* @param error The error.
|
||||
*/
|
||||
function api_error(error) {
|
||||
@@ -1293,7 +1286,7 @@ function api_requestPermission(permission, id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Log from the app to the console.
|
||||
*/
|
||||
function api_print() {
|
||||
console.log('app>', ...arguments);
|
||||
@@ -1308,7 +1301,7 @@ function api_setHash(hash) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Process an incoming WebSocket message.
|
||||
* @param message The message.
|
||||
*/
|
||||
function _receive_websocket_message(message) {
|
||||
@@ -1432,14 +1425,14 @@ function send(value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Notify the app of the window hash changing.
|
||||
*/
|
||||
function hashChange() {
|
||||
send({event: 'hashChange', hash: window.location.hash});
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Make sure the app is connected on window focus, and notify the app.
|
||||
*/
|
||||
function focus() {
|
||||
if (gSocket && gSocket.readyState == gSocket.CLOSED) {
|
||||
@@ -1450,7 +1443,7 @@ function focus() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Notify the app of lost focus.
|
||||
*/
|
||||
function blur() {
|
||||
if (gSocket && gSocket.readyState == gSocket.OPEN) {
|
||||
@@ -1617,7 +1610,7 @@ function openFile(name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Refresh the files list.
|
||||
*/
|
||||
function updateFiles() {
|
||||
let files = document.getElementsByTagName('tf-files-pane')[0];
|
||||
@@ -1650,7 +1643,7 @@ function makeNewFile(name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Prompt to create a new file.
|
||||
*/
|
||||
function newFile() {
|
||||
let name = prompt('Name of new file:', 'file.js');
|
||||
@@ -1660,7 +1653,7 @@ function newFile() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Prompt to remove a file.
|
||||
*/
|
||||
function removeFile() {
|
||||
if (confirm('Remove ' + gCurrentFile + '?')) {
|
||||
@@ -1670,7 +1663,7 @@ function removeFile() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Export the app to a zip file, which is downloaded by the browser.
|
||||
*/
|
||||
async function appExport() {
|
||||
let JsZip = (await import('/static/jszip.min.js')).default;
|
||||
@@ -1728,7 +1721,7 @@ async function save_file_to_blob_id(name, file) {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Prompt to import an app from a zip file.
|
||||
*/
|
||||
async function appImport() {
|
||||
let JsZip = (await import('/static/jszip.min.js')).default;
|
||||
@@ -1855,7 +1848,9 @@ function toggleVisibleWhitespace() {
|
||||
}
|
||||
}
|
||||
|
||||
// TODOC
|
||||
/**
|
||||
* Register event handlers and connect the WebSocket on load.
|
||||
*/
|
||||
window.addEventListener('load', function () {
|
||||
window.addEventListener('hashchange', hashChange);
|
||||
window.addEventListener('focus', focus);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
/**
|
||||
* Parse a URL into protocol, host, path, and port parts.
|
||||
* @param url
|
||||
* @returns An object of the URL parts.
|
||||
* @return An object of the URL parts.
|
||||
*/
|
||||
function parseUrl(url) {
|
||||
// XXX: Hack.
|
||||
@@ -24,7 +24,7 @@ function parseUrl(url) {
|
||||
/**
|
||||
* Parse an HTTP response into headers and body content.
|
||||
* @param data The response data, headers and body included.
|
||||
* @returns headers and body data.
|
||||
* @return headers and body data.
|
||||
*/
|
||||
function parseResponse(data) {
|
||||
let firstLine;
|
||||
|
Reference in New Issue
Block a user