JavaScript source of truth for the Salesforce Mobile SDK hybrid (Cordova) stack.
This repository is included as a git submodule inside both SalesforceMobileSDK-Android (at external/shared/) and SalesforceMobileSDK-iOS-Hybrid (at external/shared/). Its generated files are also copied into SalesforceMobileSDK-CordovaPlugin.
These are the authoritative source files for the hybrid JavaScript layer:
| File | Description |
|---|---|
cordova.force.js |
Cordova plugin bridge providing OAuth, SmartStore, MobileSync, Network, SDKInfo, and SFAccountManager plugins. These call into native code via cordova.exec(). |
force.js |
Callback-based REST API client for Salesforce: SOQL, SOSL, CRUD operations, metadata describe, and automatic token refresh. |
force+promise.js |
Promise wrapper around force.js for async/await usage. |
force+files.js |
Salesforce Files API utilities: upload, download, and caching with base64 encoding. |
mobilesync.js |
Data synchronization framework built on Backbone.js: sync down (SOQL/MRU targets), sync up, and conflict detection. |
These files are in Cordova plugin format and are what gets copied to SalesforceMobileSDK-CordovaPlugin/www/ by the CordovaPlugin's tools/update.sh script.
Do not edit these files directly. Edit the source in libs/ and regenerate.
com.salesforce.plugin.mobilesync.jscom.salesforce.plugin.network.jscom.salesforce.plugin.oauth.jscom.salesforce.plugin.sdkinfo.jscom.salesforce.plugin.sfaccountmanager.jscom.salesforce.plugin.smartstore.client.jscom.salesforce.plugin.smartstore.jscom.salesforce.util.bootstrap.jscom.salesforce.util.event.jscom.salesforce.util.exec.jscom.salesforce.util.logger.jscom.salesforce.util.promiser.jscom.salesforce.util.push.js
HTML/JavaScript sample apps used by hybrid sample apps in the Android and iOS-Hybrid repos (which include this repo as a submodule):
accounteditor-- Account CRUD operationscontactexplorer-- Contact list browser with searchfileexplorer-- File upload and downloadmobilesyncexplorer-- Offline data sync with MobileSyncsimplesyncreact-- React-based sync samplesmartstoreexplorer-- SmartStore operations and Smart SQLuserandgroupsearch-- Combined user and group searchuserlist-- User list displayusersearch-- User searchvfconnector-- Visualforce connector
To run a sample, create a hybrid app using the SDK templates, replace the app's www/ content with the sample code, and build for iOS or Android.
This repository is a git submodule at external/shared/ in both:
Hybrid sample apps in those repos reference JavaScript directly from the submodule. When changes are merged here, both repos must update their submodule pointer:
cd external/shared
git checkout dev
git pull origin dev
cd ../..
git add external/shared
git commit -m "Update Shared submodule"- Edit source files in
libs/. - Regenerate the
gen/plugins/com.salesforce/files. - Update the submodule reference in the Android and iOS-Hybrid repos.
- Run
tools/update.shin the CordovaPlugin repo to copy the new generated files into itswww/directory.
setversion.sh updates the SDK version number in this repo:
./setversion.sh -v 14.0.0This updates SALESFORCE_MOBILE_SDK_VERSION in libs/cordova.force.js and then automatically runs ./tools/update.sh to propagate the new version into all generated files under gen/plugins/com.salesforce/.
This script has no -d (isDev) flag — version bumps here are unconditional. It is run on both dev and master branches as part of the release process.
| Repository | Role |
|---|---|
| SalesforceMobileSDK-CordovaPlugin | Distribution package for the Cordova plugin; copies generated files from this repo |
| SalesforceMobileSDK-Android | Native Android SDK; hosts this repo as a submodule for hybrid apps |
| SalesforceMobileSDK-iOS-Hybrid | Native iOS hybrid bridge; hosts this repo as a submodule for hybrid apps |