ethers.js/docs.wrm/api/utils/web.wrm

76 lines
2.6 KiB
Plaintext
Raw Permalink Normal View History

2020-05-08 03:24:40 -04:00
_section: Web Utilities @<web>
2020-02-17 17:56:13 -05:00
2020-05-08 03:24:40 -04:00
_property: ethers.utils.fetchJson(urlOrConnectionInfo [, json [ , processFunc ] ]) => Promise<any> @<utils-fetchJson>
2020-02-17 17:56:13 -05:00
Fetch and parse the JSON content from //urlOrConnectionInfo//, with the
2020-11-22 23:03:50 -05:00
optional body //json// and optionally processing the result with //processFun//
2020-02-17 17:56:13 -05:00
before returning it.
2020-05-08 03:24:40 -04:00
_property: ethers.utils.poll(pollFunc [, options ]) => Promise<any> @<utils-poll>
Repeatedly call pollFunc using the [[PollOptions]] until it returns a
2020-02-17 17:56:13 -05:00
value other than undefined.
2020-05-08 03:24:40 -04:00
_heading: ConnectionInfo @<ConnectionInfo>
2020-02-17 17:56:13 -05:00
_property: connection.url => string
The URL to connect to.
_property: connection.user => string
The username to use for [[link-wiki-basicauth]].
The default is null (i.e. do not use basic authentication)
_property: connection.password => string
The password to use for [[link-wiki-basicauth]].
The default is null (i.e. do not use basic authentication)
_property: connection.allowInsecureAuthentication => boolean
Allow [[link-wiki-basicauth]] over non-secure HTTP. The default is false.
_property: connection.timeout => number
How long to wait before rejecting with a //timeout// error.
_property: connection.headers => { [ key: string]: string }
Additional headers to include in the connection.
_property: connection.skipFetchSetup => boolean
Normally a connection will specify the default values for a connection
such as CORS-behavior and caching policy, to ensure compatibility across
platforms. On some services, such as Cloudflare Workers, specifying any
value (inclluding the default values) will cause failure. Setting this
to true will prevent any values being passed to the underlying API.
2020-02-17 17:56:13 -05:00
2020-05-08 03:24:40 -04:00
_heading: PollOptions @<PollOptions>
2020-02-17 17:56:13 -05:00
_property: options.timeout => number
2020-10-03 13:30:15 -03:00
The amount of time allowed to elapse before triggering a timeout
2020-02-17 17:56:13 -05:00
error.
_property: options.floor => number
The minimum time limit to allow for [[link-wiki-backoff]].
The default is 0s.
_property: options.ceiling => number
The maximum time limit to allow for [[link-wiki-backoff]].
The default is 10s.
_property: options.interval => number
The interval used during [[link-wiki-backoff]] calculation.
The default is 250ms.
_property: options.retryLimit => number
The number of times to retry in the event of an error or //undefined// is
returned.
2020-05-08 03:24:40 -04:00
_property: options.onceBlock => [[Provider]]
2020-02-17 17:56:13 -05:00
If this is specified, the polling will wait on new blocks from
//provider// before attempting the //pollFunc// again.
2020-05-08 03:24:40 -04:00
_property: options.oncePoll => [[Provider]]
If this is specified, the polling will occur on each poll
cycle of //provider// before attempting the //pollFunc//
again.