Basic functionality

Some basic functionality doesn't include talking to modules.

Introduction

Some common functionality is location at the root of the API.

Where to find: startiapp

Methods

isRunningInApp

isRunningInApp(): boolean

Is the site running inside starti.app? Returns false if the site is loaded in a normal browser.

initialize

initialize(options?: IntitializeOptions): void

Use this method to tell the app the website is ready. Optionally you can pass an options object to the function.

options?

  • allowDrag?: boolean Control if users can drag draggable elements such as images and links in the app. Is false by default.

  • allowZoom?: boolean Control if users can zoom in in the app. Is false by default.

  • allowHighligt?: boolean Control if users can highligt text in the app. Is false by default.

  • allowScrollBounce?: boolean Control if the browser native feature scroll bounce is active. If true, users can overscroll at top or bottom of site to reveal background. Is false by default.

  • allowRotation?: boolean Control if users can rotate the device. Is false by default.

  • allowSwipeNavigation?: boolean Control if users can navigate by swiping. Is true by default.

  • statusBar?: SetStatusBarOptions Control the appearance of the status bar.

    • hideText?: boolean Controls if the text in the status bar should be hidden. Is false by default.
    • darkContent?: boolean Controls if the text in the status bar should be light or dark, False means the text will be black and True means the text will be white. Is false by default.
    • removeSafeArea?: boolean Controls if the safe area should be removed. Is true by default.
    • safeAreaBackgroundColor?: string Controls the background color of the safe area if removeSafeArea is set to False. Is #000000 by default.

Events

ready

ready

This event is called once the app is ready to talk to the website.

As soon as possible after this event is called, you should call the initialize method.

Example:

startiapp.addEventListener(
    'ready',
    function () {
        alert('The system is now ready.');
    }
);

error

error: {
  detail: { message: string: additionalDetails: string }
}

If an error occurs in the app in relation to a call from the website to the app, the exception will be caught and transferred to the website through this event.

startiapp.addEventListener(
    'error',
    function (error) {
        alert('An error occurred: ' + error.detail.message);
    }
);