doc: add JSDoc annotations in the core folder
start documenting a bit, mostly inconsequential changes
This commit is contained in:
@ -3,6 +3,10 @@ let g_api = {};
|
||||
let g_next_id = 1;
|
||||
let g_calls = {};
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @returns
|
||||
*/
|
||||
function get_is_browser() {
|
||||
try { return window !== undefined && console !== undefined; } catch { return false; }
|
||||
}
|
||||
@ -11,6 +15,13 @@ if (k_is_browser) {
|
||||
print = console.log;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @param {*} target
|
||||
* @param {*} prop
|
||||
* @param {*} receiver
|
||||
* @returns
|
||||
*/
|
||||
function make_rpc(target, prop, receiver) {
|
||||
return function() {
|
||||
let id = g_next_id++;
|
||||
@ -29,6 +40,10 @@ function make_rpc(target, prop, receiver) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @param {*} response
|
||||
*/
|
||||
function send(response) {
|
||||
if (k_is_browser) {
|
||||
window.parent.postMessage(response, '*');
|
||||
@ -37,6 +52,10 @@ function send(response) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @param {*} message
|
||||
*/
|
||||
function call_rpc(message) {
|
||||
if (message && message.message === 'tfrpc') {
|
||||
let id = message.id;
|
||||
@ -85,6 +104,10 @@ if (k_is_browser) {
|
||||
|
||||
export let rpc = new Proxy({}, {get: make_rpc});
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* @param {*} method
|
||||
*/
|
||||
export function register(method) {
|
||||
g_api[method.name] = method;
|
||||
}
|
||||
|
Reference in New Issue
Block a user