Return promise from init

This commit is contained in:
Roman Hotsiy 2015-12-22 18:16:07 +02:00
parent 61dd2ef18f
commit 794232257b

View File

@ -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;