Allow any provider into API constructor (#444)

* Allow any provider into API constructor

* Update documentation

* Remove combineLatest exposure (deprecation error)

* Linting & test cleanups

* Exclude docs from codeclimate
This commit is contained in:
Jaco Greeff
2018-12-06 11:28:40 +01:00
committed by GitHub
parent ba53f712e4
commit 69b05c7fef
21 changed files with 112 additions and 82 deletions
+7
View File
@@ -49,6 +49,13 @@ export default class HttpProvider implements ProviderInterface {
this.endpoint = endpoint;
}
/**
* @summary `true` when this provider supports subscriptions
*/
get hasSubscriptions (): boolean {
return false;
}
/**
* @summary Whether the node is connected or not.
* @return {boolean} true if connected
+4
View File
@@ -67,6 +67,10 @@ export default class Mock implements ProviderInterface {
this.init();
}
get hasSubscriptions (): boolean {
return false;
}
isConnected (): boolean {
return true;
}
+1
View File
@@ -42,6 +42,7 @@ export type ProviderInterface$Emitted = 'connected' | 'disconnected';
export type ProviderInterface$EmitCb = (value?: any) => any;
export interface ProviderInterface {
readonly hasSubscriptions: boolean;
isConnected (): boolean;
on (type: ProviderInterface$Emitted, sub: ProviderInterface$EmitCb): void;
send (method: string, params: Array<any>): Promise<any>;
+7
View File
@@ -95,6 +95,13 @@ export default class WsProvider implements WSProviderInterface {
}
}
/**
* @summary `true` when this provider supports subscriptions
*/
get hasSubscriptions (): boolean {
return true;
}
/**
* @summary Manually connect
* @description The [[WsProvider]] connects automatically by default, however if you decided otherwise, you may