Last active
August 29, 2015 14:23
-
-
Save russweas/2fa38965961d96290bf6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Vue = require('vue'); | |
var app = new Vue({ | |
el: 'body#mainApp', | |
data: { | |
currentView: 'loading-view', | |
app: {}, | |
viewData: { | |
'edit-view': { | |
ready: false, | |
funcs_to_call: [], | |
model: {} | |
}, | |
'analytics-view': { | |
ready: false, | |
funcs_to_call: [], | |
model: {} | |
} | |
} | |
}, | |
components: { | |
// Views | |
'analytics-view': require('./views/analytics'), | |
'edit-view': require('./views/edit'), | |
// Components | |
'piece': require('./components/Piece') | |
}, | |
methods: { | |
call: function(view, name) { | |
if(this.viewData[view].ready == true) { | |
this.viewData[view].model[name](); | |
} else { | |
this.viewData[view].funcs_to_call.push(name); | |
} | |
} | |
}, | |
ready: function() { | |
this.app = this; | |
this.app.call('analytics-view', 'al'); //Test caling the al function | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment