-
Notifications
You must be signed in to change notification settings - Fork 2
Built in Helper Functions
Synchro provides a number of built-in commands in the Synchro namespace. These are automatically made accessible to Synchro modules (no "require" is necessary).
Synchro.getResourceUrl(resource)
getResourceUrl uses the resource mapper provided in the Synchro application configuration to resolve resource names to full URLs that can be used to access those resources.
Synchro.navigateToView(context, route, params)
navigateToView provides for navigation between Synchro views. The route describes the path to the desired view, and params, if present, is an object that is passed to the IntializeViewModel function of the module being navigated to.
Synchro.showMessage(context, messageBox)
showMessage causes the client device to show a message using the native message/alert mechanism on the device.
!!! Outline structure and members of messageBox
Synchro.waitFor(fn, arguments)
waitFor allows for asynchronous calls to functions (asynchronous with respect to Node.js anyway). See docs for wait.for (!!! inline some of that and include an example here)
Synchro.interimUpdate(context)
interimUpdate provides a partial viewModel update back to the client, while allowing the server module to continue processing.
Synchro.isActiveInstance(context)
isActiveInstance indicates whether the page/instance being processed is the active instance. If it returns false, that means that the instance that the calling code is processing is not current (has been navigated away from). In this case, no viewModel updates will be sent to the client.
Synchro.getMetrics(context)
getMetrics returns a metrics object containing DeviceMetrics and ViewMetrics`.