Skip to content

Install

Terminal window
npm install @mobilelocker/javascript-sdk@2
# or pin the major:
# npm install @mobilelocker/javascript-sdk@^2.0.0
# yarn add @mobilelocker/javascript-sdk@^2.0.0
import mobilelocker from '@mobilelocker/javascript-sdk'
// or named imports
import { user, crm, isIOS, MobileLockerError, GeneralErrorCode } from '@mobilelocker/javascript-sdk'

If your presentation loads scripts with <script> tags, use the UMD build instead of npm. See UMD in presentation HTML.

Artifact: dist/index.umd.js → global mobilelocker (prefer mobilelocker.default || mobilelocker).

Requirement Notes
Node.js 18+ For package installs / tooling
Mobile Locker host Most bridge APIs need the app or CDN presentation context
iOS 5.5.0+ Required for contacts/CRM cursor list walks (getPage / eachPage / get*Page / each*Page)
iOS 5.3.0+ Native localforage / improved storage routes when available

Outside Mobile Locker (local browser), many calls are no-ops or return safe fallbacks so you can develop offline.

SDK 2.0 removes unbound full-list contacts/CRM dumps. Presentations still calling removed 1.x APIs will break on matching hosts. See Getting started (cursor paging) and CHANGELOG.

Removed (1.x) Use instead
contacts.getAll() contacts.eachPage / contacts.getPage
contacts.getChunked(min, limit) contacts.getPage(limit, cursor?)
crm.getAccounts() (etc. full lists) crm.query or eachAccountsPage / getAccountsPage
storage.getAllForPresentation() storage.getAll() or getAllAcrossPresentations()