mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
docs: update callback and onLoaded docs
This commit is contained in:
parent
16313b8293
commit
f5c980ab51
15
README.md
15
README.md
|
@ -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', {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user