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) {
|
||||
SchemaManager.instance().load(schemaUrl)
|
||||
.then(() => bootstrap(Redoc))
|
||||
.then(
|
||||
() => {
|
||||
redocEvents.bootstrapped.next();
|
||||
console.log('ReDoc bootstrapped!');
|
||||
},
|
||||
error => console.log(error)
|
||||
);
|
||||
var promise = new Promise(function(resolve, reject) {
|
||||
|
||||
SchemaManager.instance().load(schemaUrl)
|
||||
.then(() => bootstrap(Redoc))
|
||||
.then(
|
||||
() => {
|
||||
redocEvents.bootstrapped.next();
|
||||
console.log('ReDoc bootstrapped!');
|
||||
resolve();
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
reject();
|
||||
}
|
||||
);
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
||||
window.Redoc = Redoc;
|
||||
|
|
Loading…
Reference in New Issue
Block a user