HTML component custom API
Overview
Setup: Component ID
Accessing the API
function waitForHtmlAPI(compId, callback, timeout) {
timeout = timeout || 5000;
var start = Date.now();
var check = function() {
if (window.FpsHtml_API && window.FpsHtml_API[compId]) {
callback(window.FpsHtml_API[compId]);
} else if (Date.now() - start < timeout) {
setTimeout(check, 100);
} else {
console.error('FpsHtml_API: component "' + compId + '" not found after ' + timeout + 'ms');
}
};
check();
}API Reference
getHtml()
getHtml()setHtml(newHtml)
setHtml(newHtml)rerender()
rerender()show()
show()hide()
hide()getData()
getData()getElement()
getElement()callEndpoint(endpoint, method, body, params, callback)
callEndpoint(endpoint, method, body, params, callback)Parameter
Type
Description
Examples
Load data and render HTML on page load
Control visibility from another HTML component
Update content on a button click
Re-run scripts after socket update
Notes
Last updated
Was this helpful?