I am having trouble finding the right syntax / sample to only trigger the async callback I have registered once the swagger document has finish loading in the browser.
Right now, the code is being called twice, once when the swagger is starting loading and once when the it has completed.
here is my current test code, which does not work...
function HandleChangeSpecPlugin(system) {
return {
statePlugins: {
spec: {
wrapActions: {
updateUrl: function updateUrl(oriAction, system) {
return function (url) {
if (self.swaggerUi) {
console.log("status: "
+ self.swaggerUi.specActions.updateLoadingStatus());
}
// more custom code goes here ...
return oriAction(url);
};
}
}
}
}
};
}
I can put a breakpoint on download-url.js and watch the value changing on 'payload', but cannot
figure out the correct way to access the value and only process the event when status is "success"...
updateLoadingStatus: (status) => {
let enums = [null, "loading", "failed", "success", "failedConfig"]
if(enums.indexOf(status) === -1) {
console.error(`Error: ${status} is not one of ${JSON.stringify(enums)}`)
}
return {
type: "spec_update_loading_status",
>> payload: status
}
}