mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-27 07:20:33 +03:00
Return promise from init
This commit is contained in:
parent
61dd2ef18f
commit
794232257b
26
lib/index.js
26
lib/index.js
|
@ -9,15 +9,23 @@ export * from './components/index';
|
||||||
|
|
||||||
|
|
||||||
export function init(schemaUrl) {
|
export function init(schemaUrl) {
|
||||||
SchemaManager.instance().load(schemaUrl)
|
var promise = new Promise(function(resolve, reject) {
|
||||||
.then(() => bootstrap(Redoc))
|
|
||||||
.then(
|
SchemaManager.instance().load(schemaUrl)
|
||||||
() => {
|
.then(() => bootstrap(Redoc))
|
||||||
redocEvents.bootstrapped.next();
|
.then(
|
||||||
console.log('ReDoc bootstrapped!');
|
() => {
|
||||||
},
|
redocEvents.bootstrapped.next();
|
||||||
error => console.log(error)
|
console.log('ReDoc bootstrapped!');
|
||||||
);
|
resolve();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log(error);
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Redoc = Redoc;
|
window.Redoc = Redoc;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user