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. Isfalse
by default.allowZoom?: boolean
Control if users can zoom in in the app. Isfalse
by default.allowHighligt?: boolean
Control if users can highligt text in the app. Isfalse
by default.allowScrollBounce?: boolean
Control if the browser native feature scroll bounce is active. Iftrue
, users can overscroll at top or bottom of site to reveal background. Isfalse
by default.allowRotation?: boolean
Control if users can rotate the device. Isfalse
by default.allowSwipeNavigation?: boolean
Control if users can navigate by swiping. Istrue
by default.statusBar?: SetStatusBarOptions
Control the appearance of the status bar.hideText?: boolean
Controls if the text in the status bar should be hidden. Isfalse
by default.darkContent?: boolean
Controls if the text in the status bar should be light or dark,False
means the text will beblack
andTrue
means the text will bewhite
. Isfalse
by default.removeSafeArea?: boolean
Controls if the safe area should be removed. Istrue
by default.safeAreaBackgroundColor?: string
Controls the background color of the safe area ifremoveSafeArea
is set toFalse
. 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);
}
);