riot-starter/app/js/app.js

55 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-03-31 06:08:51 +00:00
'use strict';
// -----------------------------------------------
// Global Application Settings
// -----------------------------------------------
const APP = {
DEBUG: true
};
riot.mixin(APP);
2018-03-31 06:08:51 +00:00
// -----------------------------------------------
// Global Riot Mixins
// -----------------------------------------------
2019-06-21 12:07:12 +00:00
riot.mixin({
2018-03-31 06:08:51 +00:00
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()
2019-06-21 12:07:12 +00:00
});
2018-03-31 06:08:51 +00:00
// -----------------------------------------------
// Routing
// -----------------------------------------------
// [ set hash base ] -----------------------------
route.base('#');
// [ define routes ] -----------------------------
// home page
route('/', function () {
riot.mount('#view', 'home');
});
2019-06-19 21:45:10 +00:00
// about page
route('/about', function () {
riot.mount('#view', 'about');
});
2018-03-31 06:08:51 +00:00
// [ start router ] ------------------------------
route.start(true);