* Move triple backticks onto new line so it doesn't break the code snippet formatting
* Add newline between dependency imports and variable declarations
* Add link to relevant line of Github repo of eventemitter3 instead of the travis build directory
* Add full stop at end of sentence in line before `@example` in .ts files, since I noticed that was the only difference between code snippet in docs that was being rendered correctly and one that was not (if the docs were generated from it). Not sure if this actually makes any difference though, but it doesn't hurt to try. i.e. change `[[unsubscribe]]` to `[[unsubscribe]].`
* Add missing code syntax for `new Ws(defaults.WS_URL)`
* Add missing `*__example__*:`
* Add missing semi-colons throughout code
* Fix typos and some grammar
* Move import of external libraries i.e. `const BN = require('bn.js');` or `const crypto = require('crypto');` before `@polkadot` ones in code
* Change from `e` to `error` in catch blocks for readable documentation
This commit is contained in:
@@ -24,6 +24,7 @@ const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSocke
|
||||
*
|
||||
* import createApi from '@polkadot/api';
|
||||
* import WsProvider from '@polkadot/api-provider/ws';
|
||||
*
|
||||
* const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
* const api = createApi(provider);
|
||||
* ```
|
||||
|
||||
@@ -40,7 +40,7 @@ interface WSProviderInterface extends ProviderInterface {
|
||||
/**
|
||||
* The WebSocket Provider allows sending requests using WebSocket. Unlike the [[HttpProvider]],
|
||||
* it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
* [[include:create_api.adoc]]
|
||||
* [[include:create_api.adoc]].
|
||||
* @example
|
||||
* ```javascript
|
||||
*
|
||||
@@ -166,12 +166,13 @@ export default class WsProvider extends E3.EventEmitter implements WSProviderInt
|
||||
* @param {string} method Subscription method
|
||||
* @param {Array<any>} params Parameters
|
||||
* @param {ProviderInterface$Callback} callback Callback
|
||||
* @return {Promise<number>} Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
|
||||
* @return {Promise<number>} Promise resolving to the dd of the subscription you can use with [[unsubscribe]].
|
||||
* @example
|
||||
* ```javascript
|
||||
*
|
||||
* const provider = new WsProvider('ws://127.0.0.1:9944')
|
||||
* const api = createApi(provider)
|
||||
* const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
* const api = createApi(provider);
|
||||
*
|
||||
* api.state.storage([[storage.staking.public.freeBalanceOf, <Address>]], (_, values) => {
|
||||
* console.log(values)
|
||||
* }).then((subscriptionId) => {
|
||||
|
||||
Reference in New Issue
Block a user