Extensions issue loading indicator

This commit is contained in:
Mo Bitar
2018-07-19 10:16:53 -05:00
parent 382c40cfa6
commit 8a127f97a1
4 changed files with 33 additions and 8 deletions

View File

@@ -23,15 +23,25 @@ class ComponentView {
// console.log("Registering handler", $scope.identifier, $scope.component.name);
this.componentManager.registerHandler({identifier: $scope.identifier, areas: [$scope.component.area], activationHandler: (component) => {
// activationHandlers may be called multiple times, design below to be idempotent
if(component.active) {
this.timeout(() => {
var iframe = this.componentManager.iframeForComponent(component);
if(iframe) {
iframe.onload = function() {
this.componentManager.registerComponentWindow(component, iframe.contentWindow);
}.bind(this);
}
});
$scope.loading = true;
let iframe = this.componentManager.iframeForComponent(component);
if(iframe) {
// begin loading error handler. If onload isn't called in x seconds, display an error
if($scope.loadTimeout) { this.timeout.cancel($scope.loadTimeout);}
$scope.loadTimeout = this.timeout(() => {
if($scope.loading) {
$scope.issueLoading = true;
}
}, 3500)
iframe.onload = function(event) {
this.timeout.cancel($scope.loadTimeout);
$scope.loading = false;
$scope.issueLoading = false;
this.componentManager.registerComponentWindow(component, iframe.contentWindow);
}.bind(this);
}
}
},
actionHandler: (component, action, data) => {