Web SDK

Tendarts.init(options)
Arguments:
  • options (object) – SDK starting options.
  • options.token (string) – Needed. Application token povided with 10darts application.
  • options.publicKey (string) – Needed. Public key povided with 10darts application.
  • options.autosubscribe (string) – Automatically requests users permission (default false).
  • options.geolocation (string) – Saves the user’s location (default false).
  • options.degug (string) – Show log messages in console (default false).
  • options.key (string or object) – tag associated to the device created or key/value associated to the device.
  • options.key.label (string) – key name.
  • options.key.value (string) – value associated with the key.
  • options.key.kind (int) – value type associated to the key so it is correctly represented, 0: float, 1: int, 2: string, 3: bool. (default 3).
  • options.scope (string) – Representing a URL that defines a service worker’s registration scope (default: ‘/’).
  • options.serviceWorkerPath (string) – URL of the service worker script (default: ‘/’).
Tendarts.subscribe()

Requests users permission to register the application and receive push notifications.

Tendarts.unsubscribe()

Removes user subscription and he will not receive any other push notifications.

Tendarts.clear()

Removes user subscription and local saved data.

Tendarts.linkDeviceClientData(clientData)

Links the device with the user with a certain client data.

Arguments:
  • client_data (string) – client’s unique reference to identify the user.
Tendarts.saveKey(label, value, kind):()

Creates a key or a key/value associated to the registered device. You can create keys with no value as if they were tags.

Arguments:
  • label (string) – key name.
  • value (string) – value associated with the key.
  • kind (int) – value type associated to the key so it is correctly represented, 0: float, 1: int, 2: string, 3: bool. (default 3).