diff --git a/lib/index.js b/lib/index.js index 6c91fa5f..c5152bb7 100644 --- a/lib/index.js +++ b/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;