2.0.42 • Published 7 years ago

relayr-browser-sdk v2.0.42

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

The relayr JavaScript SDK

Welcome to the relayr JavaScript SDK. This easy to use JavaScript implementation will allow you to quickly create relayr client-side web applications, start receiving data from your sensors, and display the data received in your application.

##Requirements

For this implementation of the SDK, we are assuming that you will be transpiling using Babel and packaging using Webpack. Future updates will include the option to just include the SDK in a script tag.

Implementing the SDK

The easiest way to start using the SDK is to install it via npm:

npm install relayr-browser-sdk

This will include the minified file of the SDK in the node-modules folder of your project, which you can then import in your javascript code, using

import relayrSDK from 'relayr-browser-sdk';

If you wish to work with the entire repository, you can find the latest version at https://github.com/relayr/browser-sdk .

Using the SDK

For a list of the basic available functionalities in the SDK please refer to our Web Development Documentation

Usage

The basic functionalities of the SDK are behind authentication, so to get that far, initalize the project with the project ID and redirect URI provided to the relayr dashboard:

const RELAYR = relayrSDK;

RELAYR.init({
    id: "yourIdHere",
    redirectURI: "http://your.uri"
});

Then you can authorize your app to access the data provided by your devices, as well as other functionalities of the relayr cloud platform.

RELAYR.authorize().then((currentUser) => {...}).catch((err) => {...});

Because this version of the SDK is based on ES6 Promises, we recommend that you include a .catch statement in your code, so that errors will not fall through unheard.

Available Methods

Build

In the event that you would prefer to work with the entire repository rather than the minified version on npm, you will need to build the package before use:

npm run build:js
npm run build:min:js

Tests

Tests are available for the SDK, using Mocha, Chai, and the expect assertion library

npm test
npm run test:watch

See here for further details on the assertion library.

2.0.42

7 years ago

2.0.41

7 years ago

2.0.40

7 years ago

2.0.38

7 years ago

2.0.36

7 years ago

2.0.35

7 years ago

2.0.33

7 years ago

2.0.32

7 years ago

2.0.31

7 years ago

2.0.30

7 years ago

2.0.29

7 years ago

2.0.27

7 years ago

2.0.25

8 years ago

2.0.23

8 years ago

2.0.21

8 years ago

2.0.18

8 years ago

2.0.17

8 years ago

2.0.15

8 years ago

2.0.14

8 years ago

2.0.11

8 years ago

2.0.10

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago