delete modules before removing the old container

This commit is contained in:
Quentin Hocdé
2017-10-11 10:49:40 -04:00
parent 6d779b55c5
commit 30063039a3
4 changed files with 21 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/* jshint esnext: true */
import { APP_NAME, $document } from './utils/environment';
import { APP_NAME, $document, $barba } from './utils/environment';
import globals from './globals';
@@ -107,7 +107,7 @@ class App {
} else if (event.$scope instanceof jQuery && event.$scope.length > 0) {
$moduleEls = event.$scope.find('[data-module]');
} else if (event.isBarba) {
$moduleEls = $('#js-barba-wrapper').find('[data-module]');
$moduleEls = $barba.find('[data-module]');
}
// Loop through elements

View File

@@ -1,5 +1,5 @@
/* jshint esnext: true */
import { APP_NAME, $document, $html } from '../utils/environment';
import { APP_NAME, $document, $html, $barba } from '../utils/environment';
import { EVENT as APP_EVENT } from '../App';
function DefaultTransition(options) {
@@ -24,6 +24,11 @@ function DefaultTransition(options) {
}, 1000);
},
finish: function() {
$document.triggerHandler({
type: APP_EVENT.DELETE_SCOPED_MODULES,
$scope: $barba
});
this.done();
const $el = $(this.newContainer);

View File

@@ -5,6 +5,7 @@ const $document = $(document);
const $window = $(window);
const $html = $(document.documentElement).removeClass('has-no-js').addClass('has-js');
const $body = $(document.body);
const $barba = $('#js-barba-wrapper');
const isDebug = !!$html.data('debug');

File diff suppressed because one or more lines are too long