mirror of
https://github.com/Redocly/redoc.git
synced 2024-09-21 11:18:48 +03:00
34 lines
791 B
JavaScript
34 lines
791 B
JavaScript
'use strict';
|
|
|
|
import {bootstrap} from 'angular2/platform/browser';
|
|
import {Redoc} from './components/index';
|
|
import SchemaManager from './utils/SchemaManager';
|
|
import {redocEvents} from './events';
|
|
import OptionsManager from './options';
|
|
export * from './components/index';
|
|
|
|
export function init(schemaUrl, options) {
|
|
var promise = new Promise(function(resolve, reject) {
|
|
|
|
SchemaManager.instance().load(schemaUrl)
|
|
.then(() => {
|
|
(new OptionsManager()).options = options;
|
|
return bootstrap(Redoc);
|
|
})
|
|
.then(
|
|
() => {
|
|
redocEvents.bootstrapped.next();
|
|
console.log('ReDoc bootstrapped!');
|
|
resolve();
|
|
},
|
|
error => {
|
|
console.log(error);
|
|
reject();
|
|
}
|
|
);
|
|
});
|
|
return promise;
|
|
}
|
|
|
|
window.Redoc = Redoc;
|