Skip to main content

Synapse

Making web and native communication much more simpler and effective!

Table of Contents

Overview

Synapse provides generalised events bus for improved communication in a WebView environment.

The event bus consists of two types of callbacks - AppCallbacks and WebCallbacks.

AppCallbacks

AppCallbacks are the events which propagates from web to the native app via the native bridge. They are defined at the native app and are called from the web app.

These events are also termed as postMessage based callbacks.

On web, these callbacks can be invoked as -

window.synapse.AppCallbacks.<interfaceName>.<methodName>([data] [, successCallbackHandlerSignature] [, failureCallbackHandlerSignature])

Note- successCallbackHandlerSignature and failureCallbackHandlerSignature are the optional WebCallbacks, which needs to be passed in the defined format - "<interfaceName>.<methodName>"

WebCallbacks

WebCallbacks are the events which propagates from native app to the web via the web bridge. They are defined at the web and are called from the native app.

These events are also termed as onMessage based callbacks.

On native, these callbacks can be invoked as -

window.synapse.WebCallbacks.<interfaceName>.<methodName>([data])

Note- In Android/iOS execution context, these callbacks can be executed via JS evaluator tools.

Installation

Steps for installation on web platform can be found in this doc - Synapse: Web Package

Further installation on native platforms (Android / iOS) shall be done via steps mentioned in these docs -

Interfaces

Interfaces guidelines can be found here - Synapse: Interfaces