Display name of the Action that will appear in Umajin App Creator.
Reference to the function that will be called when the Action is fired.
Add a Boolean parameter to the action. The value is sent to the callback.
var uActions = require('u-actions');
new uActions.Action('Say hello', sayHello)
.addBooleanParameter('Show in popup?', true)
.register();
function sayHello(showInPopup) {
var greeting = 'Hello world';
if (showInPopup) {
uActions.showPopup(greeting);
}
}
Name of the parameter that will show in Umajin App Creator.
The initial value the parameter is set to.
Add a custom description to the action.
var uActions = require('u-actions');
var Action = uActions.Action;
new Action('Welcome new user', welcomeNewUser)
.addDescription('This is the demo function.')
.addIcon('images/presets/icon_loyalty_on.png')
.register();
function welcomeNewUser() {
uActions.showPopup('Welcome to Umajin!');
}
Add a Hard Coded parameter to the action. The value is sent to the callback. The user can not change this value.
Name of the parameter.
Add a custom icon to the action. The image could be seen above the action's name in the action selector.
new uActions.Action('Say hello', sayHello)
.addIcon('images/presets/icon_loyalty_on.png')
.register();
function sayHello(showInPopup) {
uActions.showPopup('Hello');
}
Can be the name of the icon file (with or without extension) inside the scripts folder, or a path to an image inside your project folder.
Add a Int parameter to the action, that shows a slider. The value is sent to the callback.
var uActions = require('u-actions');
new uActions.Action('show degree', showDegree)
.addIntParameter('degree',5,0,10)
.register();
function showDegree(degree) {
uActions.showPopup('The degree is: '+ degree+ ' Celsius.');
}
Name of the parameter that will show in Umajin App Creator.
The initial value the parameter is set to.
The minimum value that the user can set.
The maximum value that the user can set.
Add a typed parameter to the action. The value is sent to the callback.
var uActions = require('u-actions');
new uActions.Action('Say hello', sayHello)
.addStringParameter('Your Name', 'World')
.addParameter('Text Output', uActions.ParamType.TEXT)
.register();
function sayHello(yourName, textOutput) {
var greeting = 'Hello ' + yourName + '!';
textOutput.text = greeting;
}
Name of the parameter that will show in Umajin App Creator.
Parameter type can be any of the parameter types from "actions.ParamType". If none is specified, then no filter is applied.
Add a Real parameter to the action, that shows a slider. The value is sent to the callback.
var uActions = require('u-actions');
new uActions.Action('measure the distance', measurement)
.addRealParameter('distance',5.5,0.0,10.5)
.addParameter('result',uActions.ParamType.TEXT)
.register();
function measurement(distance,reuslt) {
reuslt.text='The distance is: '+distance+ ' cm.';
}
Name of the parameter that will show in Umajin App Creator.
The initial value the parameter is set to.
The minimum value that the user can set.
The maximum value that the user can set.
Add a Slider parameter to the action, that shows a slider. The value is sent to the callback.
var uActions = require('u-actions');
new uActions.Action('measure the distance', measurement)
.addSliderParameter('distance',6,0,10,2)
.addParameter('result',uActions.ParamType.TEXT)
.register();
function measurement(distance,reuslt) {
reuslt.text='The distance is: '+distance+ ' cm.';
}
Name of the parameter that will show in Umajin App Creator.
The initial value the parameter is set to.
The minimum value that the user can set.
The maximum value that the user can set.
The size that slider increments by.
Add a Stepper parameter to the action, that shows a stepper. The value is sent to the callback.
var uActions = require('u-actions');
new uActions.Action('measure the distance', measurement)
.addStepperParameter('distance',6,0,15,1.5)
.addParameter('result',uActions.ParamType.TEXT)
.register();
function measurement(distance,reuslt) {
reuslt.text='The distance is: '+distance+ ' cm.';
}
Name of the parameter that will show in Umajin App Creator.
The initial value the parameter is set to.
The minimum value that the user can set.
The maximum value that the user can set.
The size that stepper increments by.
Add a String parameter to the action. The value is sent to the callback.
var uActions = require('u-actions');
var Action = uActions.Action;
new Action('Welcome new user', welcomeNewUser)
.addStringParameter('Your name','Tom')
.register();
function welcomeNewUser(name) {
uActions.showPopup('Welcome '+name+ ' !');
}
Name of the parameter that will show in Umajin App Creator.
The initial value the parameter is set to.
Call register once the Action is ready, to add it into Umajin App Creator.
var uActions = require('u-actions');
var Action = uActions.Action;
new Action('Demo action', demoAction)
.register();
function demoAction() {
uActions.showPopup('Welcome to Umajin!');
}
Create an Action that can show up inside Umajin App Creator.