Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatelei/leancloudjs
Leancloud JavaScript SDK.
https://github.com/fatelei/leancloudjs
Last synced: about 1 month ago
JSON representation
Leancloud JavaScript SDK.
- Host: GitHub
- URL: https://github.com/fatelei/leancloudjs
- Owner: fatelei
- Created: 2015-11-17T05:54:35.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-18T02:59:40.000Z (about 9 years ago)
- Last Synced: 2024-11-19T09:17:58.449Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# leancloudjs
Leancloud JavaScript SDK. ![Build status](https://travis-ci.org/fatelei/leancloudjs.svg)## Install
```
npm install leancloudjs
```## Methods
### Leancloud
Initialize a instance of `Leancloud`.
+ options {Object}:
+ appId {String}: leancloud's application id, required
+ appKey {String}: leancloud's application key, required
+ timeout {Number}: Receive response timeout, default is `10000`ms
+ hostname {String}: leancloud hostname, default is `leancloud.cn`
+ version {String}: api version, default is `1.1`#### Usage
```
const Leancloud = require('leancloudjs');
const cli = new Leancloud({
appId: 'application id',
appKey: 'application key'
});
```### push
Call leancloud'push notification api.
+ data {Object}:
+ alert {String}: display message
+ badge {Number}: the number of new notifications
+ sound {String}: alert sound
+ channel {String}: who receive notification
+ deviceType {String}: ios or android
+ conditions {Object}:
+ valid {Boolean}: client is valid or not, default is `true`#### Usage
```
cli.push({alert: 'test'}, 'channe', 'ios').then((rst) => {
console.log(rst);
});
```## TODOs
+ Support more leancloud apis.