Tiny JSON-RPC library - batteries not included.
This project is not stable yet!
LightRPC is a minimal library for interacting with JSON RPC. It is designed to be small and work in browser and server.
npm install lightrpc
# or if you are using yarn
yarn add lightrpc
git clone https://github.com/Sekhmet/lightrpc.git
cd lightrpc
npm install
<script src="https://unpkg.com/lightrpc/dist/lightrpc.js"></script>
Or if you want to use not minified version
<script src="https://unpkg.com/lightrpc/dist/lightrpc.min.js"></script>
// using UMD (browser)
const client = window.LightRPC.createClient('https://api.steemit.com');
// using CommonJS
const createClient = require('lightrpc').createClient;
const client = createClient('https://api.steemit.com');
// using ES6 modules
import { createClient } from 'lightrpc';
const client = createClient('https://api.steemit.com');
// sending requests
client.send('get_accounts', [usernames], function(err, result) {
if (err !== null) console.error(err);
console.log('response', result);
});
You can configure client by using optional options parameter to createClient
.
const options = {
timeout: 5000,
};
const client = createClient('https://api.steemit.com', options);
Option | Default value | Description |
---|---|---|
timeout | 5000 | Time after request should timeout. |
You can run lint and tests using npm script
npm run test
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Wiktor Tkaczyński - Sekhmet
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details