Public
Edited
Jul 21, 2024
1 fork
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
libraryURL = "https://public.dydra.com"
Insert cell
resource = libraryURL + "/test/test"
Insert cell
Insert cell
Cells = import(libraryURL + "/javascripts/ui/classes/cell.js")
Insert cell
Insert cell
ResourceAccess = import(
libraryURL + "/javascripts/replication/resource-access.js"
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/*
abstract an api variant which captures just default options and provides operators which
require the full location, content and individual options to perform the principle
HTTP operations.
*/
methodAPI = function (method = "GET", defaultOptions = {}) {
function getOperator(location, options = {}, continuation, fail) {
options = Object.assign({}, defaultOptions, options);
console.debug("methodAPI: get: ", location, options, continuation);
return Cells.Cell.getResource(location, options, continuation, fail);
}
function postOperator(location, content, options = {}, continuation, fail) {
options = Object.assign({}, defaultOptions, options);
console.debug(
"methodAPI: post: ",
location,
content,
options,
continuation
);
return Cells.Cell.postResource(
location,
content,
options,
continuation,
fail
);
}
function putOperator(location, content, options = {}, continuation, fail) {
options = Object.assign({}, defaultOptions, options);
console.debug("methodAPI: put: ", location, options, continuation);
return Cells.Cell.putResource(
location,
content,
options,
continuation,
fail
);
}
function viewOperator(location, view, options = {}, continuation, fail) {
options = Object.assign({}, defaultOptions, options);
console.debug("methodAPI: view: ", location, view, options, continuation);
return Cells.Cell.getResource(
location + "/" + view,
options,
continuation,
fail
);
}
switch (method) {
case "GET":
return getOperator;
case "POST":
return postOperator;
case "PUT":
return putOperator;
case "VIEW":
return viewOperator;
default:
throw new Error(`methodAPI: invalid method: ${method}`);
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { form } from "@mbostock/form-input"
Insert cell
x = postObject({}, {})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more