docs: update callback and onLoaded docs

This commit is contained in:
Roman Hotsiy 2018-06-25 13:56:52 +03:00
parent 16313b8293
commit f5c980ab51
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -167,6 +167,19 @@ Also you can pass options:
Here are detailed [options docs](#redoc-options-object). Here are detailed [options docs](#redoc-options-object).
You can also specify `onLoaded` callback which will be called each time Redoc has been fully rendered or when error occurs (with an error as the first argument). *NOTE*: It may be called multiply times if you change component properties
```js
<RedocStandalone
specUrl="http://rebilly.github.io/RebillyAPI/swagger.json"
onLoaded={error => {
if (!error) {
console.log('Yay!');
}
}}
/>
```
## ReDoc CLI ## ReDoc CLI
[See here](https://github.com/Rebilly/ReDoc/blob/master/cli/README.md) [See here](https://github.com/Rebilly/ReDoc/blob/master/cli/README.md)
@ -218,7 +231,7 @@ Redoc.init(specOrSpecUrl, options, element, callback?)
- `specOrSpecUrl` is either JSON object with specification or an URL to the spec in `JSON` or `YAML` format - `specOrSpecUrl` is either JSON object with specification or an URL to the spec in `JSON` or `YAML` format
- `options` [options object](#redoc-options-object) - `options` [options object](#redoc-options-object)
- `element` DOM element to put ReDoc into - `element` DOM element to put ReDoc into
- `callback` (optional) - callback to be called after Redoc has been fully rendered - `callback` (optional) - callback to be called after Redoc has been fully rendered. It is also called also on errors with error as the first argument
```js ```js
Redoc.init('http://petstore.swagger.io/v2/swagger.json', { Redoc.init('http://petstore.swagger.io/v2/swagger.json', {