Skip to content

Instantly share code, notes, and snippets.

@zewa666
Forked from mar9000/app.html
Last active March 16, 2022 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save zewa666/6e5d8a599932dcdd04f4363c7c731a1a to your computer and use it in GitHub Desktop.
Save zewa666/6e5d8a599932dcdd04f4363c7c731a1a to your computer and use it in GitHub Desktop.
Aurelia Store gist
<template>
<h1>Frameworks</h1>
<ul>
<li repeat.for="framework of state.frameworks">${framework}</li>
</ul>
</template>
// app.js
import { inject } from "aurelia-dependency-injection";
import { Store } from "aurelia-store";
@inject(Store)
export class App {
constructor(store) { this.store = store; }
bind() {
this.subscription = this.store.state.subscribe(
(state) => this.state = state
);
}
unbind() {
this.subscription.unsubscribe();
}
}
<!doctype html>
<html>
<head>
<title>Aurelia Store gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="main">
<h1>Loading....</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script>
<script src="https://rawgit.com/zewa666/aurelia-kendoui-bundles/1.9.3/config2.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
/*******************************************************************************
* The following two lines enable async/await without using babel's
* "runtime" transformer. Uncomment the lines if you intend to use async/await.
*
* More info here: https://github.com/jdanyow/aurelia-plunker/issues/2
*/
//import regeneratorRuntime from 'babel-runtime/regenerator';
//window.regeneratorRuntime = regeneratorRuntime;
/******************************************************************************/
import { initialState } from "./state";
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin("aurelia-store", { initialState });
aurelia.start().then(a => a.setRoot());
}
export const initialState = {
frameworks: ["Aurelia", "React", "Angular"]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment