everlive-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.9.4 • Public • Published

Everlive JavaScript SDK

The Everlive JavaScript SDK, also known as the Backend Services JavaScript SDK, allows you to use the backend services provided by Telerik Platform by Progress from any JavaScript application.

Internally, Telerik Platform by Progress uses the Backend Services JavaScript SDK in:

  • Cloud Code
  • API Server

The Backend Services JavaScript SDK is packaged with Browserify for all environments except for Node.js, where you can use the code found in the src folder directly.

For additional topics, see the official Telerik Platform by Progress documentation: Getting Started with the Backend Services JavaScript SDK.

Installing

Depending on your preferred sourcing method, do the following to install the Backend Services JavaScript SDK.

  • NPM

    npm install
    
  • Bower

    bower install everlive
    
  • Online copy

    https://bs-static.cdn.telerik.com/latest/everlive.all.min.js
    
  • Download

    https://bs-static.cdn.telerik.com/sdk/latest/javascript/EverliveSDK.JS.zip
    

Supported Environments and Adding the SDK

Use the following line of code to add the Backend Services JavaScript SDK to your project depending on your JavaScript environment of choice:

  • Browser:

    <script src="path/to/sdk/everlive.all.js"></script>
    
  • Node.js:

    var Everlive = require('everlive-sdk');
    
  • Cordova (Android, iOS, Windows Phone):

    <script src="path/to/sdk/everlive.all.js"></script>
    
  • NativeScript (Android, iOS):

    var Everlive = require('everlive-sdk');
    
  • ECMAScript 6 and TypeScript:<br >Note: Use Typescript compiler version 2.0 or later.

    import Everlive from 'everlive-sdk'
    

Development

The source code is available in the src folder. The entry point of the application is index.everlive.ts.

To build the source code, run either of the following commands. They output everlive.js and everlive.map to the project root.

  • Build once:

    npm run build
    
  • Rebuild automatically on each change:

    npm run watch
    

To make a distribution build, use the following command:

npm start

It outputs the following files:

|-- root
    |-- dist
        |-- everlive.all.js
        |-- everlive.all.map
        |-- everlive.all.min.js
        |-- license
        |-- readme
        |-- declarations (contains the TS declarations)
|-- EverliveSDK.JS.zip

Usage

To learn how to use the Backend Services JavaScript SDK in your applications, head to the official documentation.

Testing

The source code features automated tests for each supported environment in the test folder. There are mobile projects for Cordova and Nativescript located in test/mobile/Everlive(Cordova|NativeScript).

Currently there are automated tests only for Android.

External files for Node.js and PhantomJS are located in test/external.

Setting Up Testing

You need to set up the following on your system before you can run tests.

Running Tests

The easiest way to run tests is to open the test suite's .html file in a web browser. For example, open test/suites/everlive-caching/everlive-caching.html to run the entire suite of tests for the Caching feature. The other options to run tests are explained below.

To run all tests against all platforms sequentially, run:

$ npm run test

Most of the time, you will want to run tests against a specific platform:

$ npm run test --platform {desktop | nodejs | cordova | nativescript}

If you want to run only a specific suite, specify it using the suite flag. By convention, it tries to find the suite in test/suites/{suite-name}/{suite-name}.html.

$ npm run test --platform cordova --suite everlive-files

The test results appear as console messages but also output to files called tap reports in test/testResults(platform).tap. For example:

1..770
ok 0 Everlive data -  Online  EmailSubscribers Everlive data -  offline control offline should throw when offline not enabled
ok 1 Everlive data -  Online  EmailSubscribers Everlive data -  offline control isOffline should throw when offline not enabled
not ok 2 Everlive data -  Online  EmailSubscribers Everlive data -  offline control isOnline should throw when offline not enabled -   AssertionError: expected 'expected false to be truthy' to equal 'You have instantiated the SDK without support for offline storage'

Configuring Tests

By default, each platform's tests are run against a different backend-services project. This setting can be changed in test/suites/externalconfig.template.js.

Creating Tests

When writing tests, add them to test/suites/everlive-{suite-name} folders. Each such folder must contain a everlive-{suite-name}.html file which specifies its tests.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Everlive tests</title>
</head>
<body>
<script src="../../TestRunner.js" data-js="everlive-caching.test.js"></script>
</body>
</html>

This is what a simple test looks like:

describe("Test", function () {
    ok(1 === 1);
}

The combination of HTML file and JavaScript file loads all scripts and CSS needed by default (see test/TestRunner.js), creates a div[id=mocha], and adds the scripts specified in the data-js attribute.

The TestRunner can be accessed from window.runner.

Readme

Keywords

none

Package Sidebar

Install

npm i everlive-sdk

Weekly Downloads

57

Version

1.9.4

License

Telerik

Last publish

Collaborators

  • everlive-system