riot-starter/src/public/js/app.js

48 lines
1.0 KiB
JavaScript

'use strict';
// -----------------------------------------------
// Global Application Settings
// -----------------------------------------------
const APP = {
DEBUG: true
};
// -----------------------------------------------
// Global Riot Mixins
// -----------------------------------------------
riot.mixin = {
store: {
get: function (key) {
return window.localStorage.getItem(key);
},
set: function (key, value) {
return window.localStorage.setItem(key, value);
},
remove: function (key) {
return window.localStorage.removeItem(key);
}
},
relay: riot.observable()
}
// -----------------------------------------------
// Routing
// -----------------------------------------------
// [ set hash base ] -----------------------------
route.base('#');
// [ define routes ] -----------------------------
// home page
route('/', function () {
riot.mount('#view', 'home');
});
// [ start router ] ------------------------------
route.start(true);