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?: booleanControl if users can drag draggable elements such as images and links in the app. Isfalseby default.allowZoom?: booleanControl if users can zoom in in the app. Isfalseby default.allowHighligt?: booleanControl if users can highligt text in the app. Isfalseby default.allowScrollBounce?: booleanControl if the browser native feature scroll bounce is active. Iftrue, users can overscroll at top or bottom of site to reveal background. Isfalseby default.allowRotation?: booleanControl if users can rotate the device. Isfalseby default.allowSwipeNavigation?: booleanControl if users can navigate by swiping. Istrueby default.statusBar?: SetStatusBarOptionsControl the appearance of the status bar.hideText?: booleanControls if the text in the status bar should be hidden. Isfalseby default.darkContent?: booleanControls if the text in the status bar should be light or dark,Falsemeans the text will bewhiteandTruemeans the text will beblack. Istrueby default.advancedSafeAreaOptions?: SafeAreaOptionsControls top and bottom safe areas individually.top?: SafeAreaSideOptionsControls color and visibility of the upper safe area.removeSafeArea: booleanControls safe area visibility.safeAreaBackgroundColor: stringControls color of safe area background.
bottom?: SafeAreaSideOptionsControls color and visibility of the lower safe area.removeSafeArea: booleanControls safe area visibility.safeAreaBackgroundColor: stringControls color of safe area background.
removeSafeArea?: booleanControls if the safe area should be removed. Istrueby default. ChangingremoveStatusBarindividually inadvancedSafeAreaOptionswill override this option.safeAreaBackgroundColor?: stringControls the background color of the safe area ifremoveSafeAreais set toFalse. Is#000000by default. ChangingsafeAreaBackgroundColorindividually inadvancedSafeAreaOptionswill override this option.
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);
}
);