Developers with Early Access can access the app creation interface at easel.inventables.com/apps.
New apps are created with the basic app skeleton. All apps are written in javascript. They declare properties and an executor function which returns an SVG.
Properties
Apps declare a var properties
in order to collect user input. Here are the 5 available property types:
var properties = [
{id: "Your file", type: "file-input"},
{id: "A number", type: "range", value: 50, min: 0, max: 100, step: 10},
{id: "A string", type: "text", value: "initial string"},
{id: "Options", type: "list", value: "a", options: [["a", "One"], ["b", "Two"]]},
{id: "True or false", type: "boolean", value: false}
];
[more documentation about the way file input works, list works is probably needed here]
Executor
The second part of the app is the executor. It is a function called executor
which gets 3 parameters.
var executor = function(params, success, failure) {
var userProperties = params[0];
var selectedVolumes = params[1];
var userNumber = userProperties["A number"];
var userBoolean = userProperties["True or false"];
var fileUrl = userProperties["Your file"];
// If you need to validate an input, return failure called with the error
if (userNumber < 0) {
return failure("You must use a positive number");
}
// Construct an SVG string and call success with it
var svgHeader = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">';
var rectElement = '<rect x="50" y="50" width="200" y="200" rx="' + userNumber + '" />';
var svgFooter = '</svg>';
success(svgHeader + rectElement + svgFooter);
};
More on the selectedVolumes
API soon.