0.1.5 • Published 5 years ago

ruban-providers v0.1.5

Weekly downloads
4
License
LGPL-3.0
Repository
github
Last release
5 years ago

ruban-providers

This is a sub module of ruban.js

Installation

npm install ruban-providers

Usage Examples

HttpProvider

You can pass with the options object the timeout and all known HTTP headers.

import {HttpProvider} from 'ruban-providers';

const options = {
    timeout: 20000,
    headers: [
        {
            name: 'Access-Control-Allow-Origin', value: '*'
        },
        ...
    ]
};

const httpProvider = new HttpProvider('http://localhost:8545', options); 

ProviderResolver

The ProviderResolver resolves an url or an given provider object to the correct provider class. Because of the resolves does ruban has internally just one provider interface and we have no direct dependency to third party providers.

import {ProviderResolver} 'ruban-providers';

const socketProviderAdapter = new ProviderResolver().resolve('http://localhost:8545');

Types

All the typescript typings are placed in the types folder.