123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- Number.prototype.currency = function() { return '$' + this.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') };
- function log() {
- console.log('LOG >>>', arguments);
- }
- function get_items() {
- var xhr = new XMLHttpRequest();
- xhr.onload = function() {
- var data = {};
- try {
- data = JSON.parse(xhr.responseText);
- } catch(e){
- log('could not parse JSON');
- }
- app.items = data;
- };
- xhr.open('GET', 'db.json', true);
- try {
- xhr.send();
- } catch(e) {
- log('err', e);
- }
- }
- var app = new Vue({
- el: '#app',
- data: {
- title: "egunner",
- items: {},
- debug: false
- },
- mounted: function () {
- // hide splash
- var splash = document.getElementById("splash");
- splash.style.display = "none";
-
- // unhide main container after mount
- this.$el.style.display = "block";
- },
- computed: {
- },
-
- methods: {
- },
-
- watch: {
- },
-
- });
- get_items();
- window.setInterval(function(){
- console.log('refresh');
- get_items();
- }, 5000);
|