Diil #
Diil.ready() |
Call once the first screen is rendered: DiiL removes its loading placeholder. |
Diil.initData |
Signed launch data (string). Send it to your server. "" without consent or outside DiiL. |
Diil.initDataUnsafe |
Parsed initData: {user, authDate, appId, hash}. Not verified. |
Diil.user |
initDataUnsafe.user or null. |
Diil.requestAuthCode() |
Promise<string>: a one-time code (60 s). Rejects with error.code: access_denied (the user declined), not_in_diil, rate_limited, network_error. |
Diil.close() |
Close the mini app. |
Diil.expand() / Diil.collapse() |
Full height / back to the default sheet height. |
Diil.openLink(url) |
Open an http(s) link outside the mini app. |
Diil.haptic(type) |
light, medium, heavy, rigid, soft, success, warning, error, selection. |
Diil.setHeaderColor('#RRGGBB') |
Colour of DiiL's header above your page. |
Diil.theme |
{colorScheme, bgColor, secondaryBgColor, textColor, hintColor, linkColor, buttonColor, buttonTextColor}, also as CSS variables --diil-bg-color, --diil-text-color, …; Diil.colorScheme is light or dark. |
Diil.viewport |
{height, isExpanded} when DiiL reports it. |
Diil.platform / Diil.version |
ios / the DiiL app version, e.g. 1.0 (36). Diil.sdkVersion is the SDK's. |
Diil.isInDiil |
true inside the DiiL app. |
Diil.reportError(error) |
Report an Error or a message to DiiL. Uncaught errors and unhandled promise rejections are reported automatically; set Diil.autoReportErrors = false to stop that. At most 20 reports per page load. |
Diil.onEvent(name, fn) / Diil.offEvent(name, fn) |
themeChanged ({theme}), viewportChanged ({height, isExpanded}), mainButtonClicked, backButtonClicked. |
Diil.MainButton #
The big button at the bottom, drawn by DiiL.
setText(text), show(), hide(), enable(), disable() |
Chainable: Diil.MainButton.setText('Pay').show(). |
showProgress() / hideProgress() |
A spinner in the button. |
setParams({text, color, textColor, isVisible, isActive}) |
Several at once. Colours #RRGGBB. |
onClick(fn) / offClick(fn) |
Tap handlers. |
text, color, textColor, isVisible, isActive, isProgressVisible |
Current state. |
Diil.BackButton #
A back arrow in DiiL's header: show(), hide(), onClick(fn), offClick(fn), isVisible.
The SDK is ES5, but requestAuthCode() returns a Promise (available in every iOS web view).