Options
All
  • Public
  • Public/Protected
  • All
Menu

Module u-actions

Actions are a fundamental building block of a Umajin App.

The u-actions module lets you create your own actions that can be used like regular actions in Umajin Editor. The module also gives you access to all the built-in actions.

var uActions = require('u-actions');

new uActions.Action('Say hello', sayHello).register();
function sayHello() {
uActions.showPopup('Hello!');
}

Index

Variables

bluetooth: BluetoothActions

Access bluetooth devices.

Access native overlays.

navigate: NavigateActions

Navigate between pages.

Access features from popular social networks.

Control audio within the app.

Functions

  • cameraCapture(callback: string): void
  • Capture a photo from the camera, and call back the specified function with the resulting filename, or blank if cancelled

    var uActions = require('u-actions');
    new uActions.Action('take a photo', takeAPhoto).register();
    function takeAPhoto() {
    uActions.cameraCapture('captureResult');
    }
    function captureResult(filePath) {
    if (filePath=='') {
    uActions.showPopup('Photo Cancelled!');
    } else {
    uActions.showPopup('Photo taken: ' + filePath);
    }
    }

    Parameters

    • callback: string

    Returns void

  • dialNumber(phoneNumber: string): void
  • Make a phone call using the default dialer app.

    var uActions = require('u-actions');
    new uActions.Action('dial number', dialNumber).register();
    function dialNumber() {
    uActions.dialNumber('063564120');
    }

    Parameters

    • phoneNumber: string

    Returns void

  • openMap(location: string): void
  • Show a location on the map using the default map app.

    var uActions = require('u-actions');
    new uActions.Action('open google map', openGoogleMap).register();
    function openGoogleMap() {
    uActions.openMap('60 Princess Street, Palmerston North Central, Palmerston North');
    }

    Parameters

    • location: string

      Address of the location to show.

    Returns void

  • sendEmail(to: string, cc: string, bcc: string, subject: string, body: string, attachment: string, mimeType: string): void
  • Send an email

    var uActions = require('u-actions');
    new uActions.Action('send email to Umajin', sendEmailToUmajin).register();
    function sendEmailToUmajin() {
    uActions.sendEmail('admin@umajin.com');
    }

    Parameters

    • to: string
    • cc: string
    • bcc: string
    • subject: string
    • body: string
    • attachment: string
    • mimeType: string

    Returns void

  • sendSMS(phoneNumber: string): void
  • Send an SMS message using the default SMS app.

    var uActions = require('u-actions');
    new uActions.Action('send message', sendMessage).register();
    function sendMessage() {
    uActions.sendSMS('063564120');
    }

    Parameters

    • phoneNumber: string

    Returns void

  • showCombo(callback: string, options: string[]): void
  • Show a combo box.

    var uActions = require('u-actions');
    var Action = uActions.Action;
    var stringArray=['red','blue','green'];
    new Action('Show combo',showCombo).register();
    function showCombo(){
    uActions.showCombo('callback_function', stringArray);
    }
    function callback_function(index, value) {
    print('index: '+ index+ ' value: '+value);
    }

    Parameters

    • callback: string

      The name of the callback function.

    • options: string[]

      An Array of item names as Strings.

    Returns void

  • showPopup(message: string): void
  • Display a popup with a message.

    var uActions = require('u-actions');
    new uActions.Action('Say hello', sayHello).register();
    function sayHello() {
    uActions.showPopup('Hello!');
    }

    Parameters

    • message: string

      The message to display in the popup.

    Returns void

  • showWebPage(url: string): void
  • Show a web page using the default web browser app.

    var uActions = require('u-actions');
    new uActions.Action('Show front page', showFrontPage).register();
    function showFrontPage() {
    uActions.showWebPage('https://umajin.com/');
    }

    Parameters

    • url: string

      The url to show.

    Returns void