API Reference

This section contains the API Reference provided by Stallion SDK

JS APIs

MethodDescriptionExample
withStallionHOC method for Stallion wrapped appwithStallion(App)
useStallionModalReact hook to control Stallion modalconst { showModal } = useStallionModal();, then call showModal from anywhere
useStallionUpdateReact hook to get status of a production releaseconst { isRestartRequired, currentlyRunningBundle, newReleaseBundle } = useStallionUpdate();. isRestartRequired is a boolean which tells if a new release is available and app needs to be restarted to install the release. currentlyRunningBundle, newReleaseBundle are objects containing meta information about a Stallion Release like isMandatory, release notes, version etc.
addEventListenerFunction to listen to SDK events related to a Stallion releaseStallion.addEventListener(callback). Callback will return an event object with a type and payload. Events can be DOWNLOAD_STARTED, DOWNLOAD_COMPLETE, UPDATE_INSTALLED, AUTO_ROLLBACK etc
syncFunction to manually trigger Stallion workflow to check for a new available release and download it in memoryStallion.sync(). Trigger this method from anywhere in your app code to manually trigger a check workflow. Useful if you want to have a custom download strategy. By default Stallion.sync() is automatically fired everytime app is restarted or resumed.

Android APIs

MethodDescriptionExample
getJSBundleFileFunction to receive the JS bundle URL for your RN app. It expects 2 arguments. 2nd argument is optional - getJSBundleFile(<your-application-context>, <default bundle URL value>)Stallion.getJSBundleFile(getApplicationContext(), "assets://index.android.bundle")

iOS APIs

MethodDescriptionExample
getBundleURLFunction to receive the JS bundle URL for your RN app. It expects 1 optional parameter - [StallionModule getBundleURL:<your-default-bundle-url-value>[StallionModule getBundleURL:[[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]]