Commit 6d223145 authored by Julien Enselme's avatar Julien Enselme
Browse files

fix(popups): correctly usage of compose with webpack

parent b06fca56
......@@ -31,7 +31,7 @@
<div class="popup" if.bind="type !== null"></div>
<div class="popup-container" tabindex="0" ref="container" if.bind="type !== null">
<div class="popup-content popup-${type} ${background}">
<compose view-model="./${type}" model.one-way="popupModel"> </compose>
<compose view-model.bind="viewModel" model.one-way="popupModel"> </compose>
</div>
</div>
</template>
......@@ -17,9 +17,23 @@
* along with Arena of Titans. If not, see <http://www.gnu.org/licenses/>.
*/
import { inject, BindingEngine } from "aurelia-framework";
import { inject, BindingEngine, PLATFORM } from "aurelia-framework";
import { EventAggregator } from "aurelia-event-aggregator";
// Make sure all popups are included in the webpack bundles. For details, see:
// https://discourse.aurelia.io/t/dynamically-loading-compose-viewmodels-using-webpack/173
PLATFORM.moduleName("./assassination-animation", "game");
PLATFORM.moduleName("./back-home", "game");
PLATFORM.moduleName("./confirm", "game");
PLATFORM.moduleName("./error", "game");
PLATFORM.moduleName("./game-over", "game");
PLATFORM.moduleName("./infos", "game");
PLATFORM.moduleName("./options", "game");
PLATFORM.moduleName("./player-box", "game");
PLATFORM.moduleName("./transition", "game");
PLATFORM.moduleName("./trump-animation", "game");
PLATFORM.moduleName("./yes-no", "game");
@inject(BindingEngine, EventAggregator)
export class AotPopupCustomElement {
data = null;
......@@ -38,6 +52,7 @@ export class AotPopupCustomElement {
this._eaSubscription = this._ea.subscribe("aot:popup:display", message => {
this.type = message.type;
this.viewModel = `./${this.type}`;
this.popupModel.data = message.data;
this.popupModel.deferred = message.deferred;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment