EasyManua.ls Logo

Embedded Systems LogicMachine5 - Page 57

Default Icon
291 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
57
rows) on widget element. Width formula: cols * 110 10, height formula: rows * 110 10
Example
Clock widget which takes double width/height and places SVG image which fills all available
space inside of widget container:
(function() {
// get widget element and set double width/height
var el = $('#clock').setWidgetSize(2, 2);
$('<object type="image/svg+xml"></object>') // object allows SVG+JavaScript
.css('width', '100%') // full width
.css('height', '100%') // full height
.attr('data', '/apps/data/clock/clock.svg') // SVG image source
.appendTo(el); // add to container
})();
Configuration
• Application directory must contain either config.lp or config.html file
• This file must contain form element, id must be set in myapp-config format, where
myapp is unique application name
• Data exchange is done via events triggered on form element:
◦ config-load (to app) provides an object with all configuration key/value pairs
◦ config-check (to app) triggered when Save button is clicked, app configuration
must either show an error message if configuration is invalid or trigger config-save
◦ config-save (from app) saves configuration on server side and closed modal
window, application must pass configuration parameters as an object
• Configuration can be accessed from Lua using these functions:
◦ config.get(app, key, default) returns single value for given application name,
default value or nil if key is not found
◦ config.getall(app) return table with all configuration values for given application
name or nil if configuration is empty
◦ config.set(app, key, value) adds a new key/value pair or overwrites an existing one
◦ config.setall(app, cfg) overwrites existing config with given cfg table with
keys/values
◦ config.delete(app, key) deletes existing key/value pair
• Unpublished apps that have configuration file present will appear under Dev apps in
admin page

Table of Contents

Other manuals for Embedded Systems LogicMachine5

Related product manuals