0.4.8 • Published 6 years ago

telepat-js v0.4.8

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

NPM Bower David

Telepat Javascript Client

UMD client for Telepat, using Webpack to run in browsers. Available on GitHub.

Telepat is an open-source backend stack, designed to deliver information and information updates in real-time to clients, while allowing for flexible deployment and simple scaling. Read more about how it works and why it's different here.

Installing

  • bower install telepat-js, if you're using Bower
  • npm install telepat-js, if you're using NPM
  • or the classic <script src="lib/telepat.js"></script>

Learning

Documentation is available here, and you can check out a simple demo here.

A simple usage example:

let telepat = new Telepat();
telepat.connect({
 apiEndpoint: 'TELEPAT-API-ENDPOINT',
 socketEndpoint: 'TELEPAT-SOCKET-ENDPOINT',
 apiKey: 'APP-API-KEY',
 appId: 'APP-ID'
}, (err, res) => {
 if (err) {
   // Treat connection error
   console.log(err);
   return;
 }

 // Display all collections
 console.log(telepat.collections);

 // Login, display and update user data
 telepat.on('login', () => {
   console.log(telepat.user.data);
   telepat.user.data.change = true;
 });
 telepat.user.login('user', 'pass');

 // Subscribe to data
 let articleChannel = telepat.subscribe({
   channel: {
     context: 'collection-identifier',
     model: 'article'
   }
 }, () => {
   console.log(articleChannel.objectsArray);
   articleChannel.objects['object-identifier'].title = 'new title';

   articleChannel.on('update', (operationType, objectId, object, oldObject) => {
     // Update interface on data updates
   });
 });
});

Building from source

Clone the repo, then run npm install. After editing the sources in the /src directory, run npm run build-all to compile the libraries, and npm run docs to generate the documentation.

License

Released under the Apache 2 License.

Credits

Telepat is built on top of the following awesome libraries:

0.4.8

6 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.5

8 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago