Skip to content

Instantly share code, notes, and snippets.

@russweas
Last active August 29, 2015 14:23
Show Gist options
  • Save russweas/2fa38965961d96290bf6 to your computer and use it in GitHub Desktop.
Save russweas/2fa38965961d96290bf6 to your computer and use it in GitHub Desktop.
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