Calling load after instantiation of SwaggerUI

This commit is contained in:
Ayush Gupta
2012-07-13 16:45:04 -07:00
parent a1320696e0
commit 56c83c5624
5 changed files with 8 additions and 7 deletions

4
dist/index.html vendored
View File

@@ -41,12 +41,14 @@
<script type="text/javascript">
$(function () {
window.ui = new SwaggerUi({
window.swaggerUi = new SwaggerUi({
discoveryUrl:"http://petstore.swagger.wordnik.com/api/resources.json",
apiKey:"special-key",
dom_id:"swagger-ui-container",
supportHeaderParams: false
});
window.swaggerUi.load();
});
</script>

3
dist/swagger-ui.js vendored
View File

@@ -650,10 +650,9 @@ templates['resource'] = template(function (Handlebars,depth0,helpers,partials,da
this.headerView = new HeaderView({
el: $('#header')
});
this.headerView.on('update-swagger-ui', function(data) {
return this.headerView.on('update-swagger-ui', function(data) {
return _this.updateSwaggerUi(data);
});
return this.load();
};
SwaggerUi.prototype.updateSwaggerUi = function(data) {

File diff suppressed because one or more lines are too long

View File

@@ -36,8 +36,6 @@ class SwaggerUi extends Backbone.Router
# Event handler for when the baseUrl/apiKey is entered by user
@headerView.on 'update-swagger-ui', (data) => @updateSwaggerUi(data)
@load()
# Event handler for when url/key is received from user
updateSwaggerUi: (data) ->
@options.discoveryUrl = data.discoveryUrl

View File

@@ -41,12 +41,14 @@
<script type="text/javascript">
$(function () {
window.ui = new SwaggerUi({
window.swaggerUi = new SwaggerUi({
discoveryUrl:"http://petstore.swagger.wordnik.com/api/resources.json",
apiKey:"special-key",
dom_id:"swagger-ui-container",
supportHeaderParams: false
});
window.swaggerUi.load();
});
</script>