Runtime Helperaksa-mini.js

aksa-mini.js

The small helper that wraps the bridge and falls back to the browser when there is no host.

The starter apps in mini-apps/ share one helper, mini-apps/_shared/aksa-mini.js. It exposes window.AksaMini and wraps the raw bridge so the same page runs in Aksa and in a plain browser.

What It Gives You

HelperWhat it does
AksaMini.mode()Returns host inside the Aksa host, page inside the Aksa app's page view, or web in a plain browser.
AksaMini.call(method, params)Calls a bridge method.
AksaMini.storeget, set and remove storage. In a browser it uses local storage, in the host the bridge.
AksaMini.context()The Action the app was opened from, or null outside Aksa.
AksaMini.checkIn(arg)Opens the linked Action's check-in in Aksa (host only).
AksaMini.requestPermissions(scopes)Asks for your declared scopes up front.
AksaMini.parseActionId(input)Turns an Action share link or a bare id into the Action id, or null.
AksaMini.streak(doneDays, today)Days in a row up to today, or up to yesterday when today is not done yet.
AksaMini.close()Closes the mini app.
AksaMini.ready(fn)Runs fn once the host is ready.

Check In

Inside an Action, context() returns an actionId, so you can check in without asking the user to link anything. Outside an Action the helper shows a "Link An Action" row where the person pastes the Action link once.

Gate Features On Answers

requestPermissions returns one answer per scope: granted, denied or unavailable. A host without the method resolves supported: false. Gate features on the answers, not on the call succeeding.

Ready to ship?

Submit An App