forked from cory/tildefriends
Oh, votes are slowing everything down. Batch them and simplify.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3648 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@@ -10,7 +10,7 @@ var g_data = {
|
||||
show_user_dialog: null,
|
||||
connect: null,
|
||||
pubs: [],
|
||||
votes: [],
|
||||
votes: {},
|
||||
apps: {},
|
||||
share_app: null,
|
||||
};
|
||||
@@ -38,6 +38,14 @@ window.addEventListener('message', function(event) {
|
||||
g_data.pubs = event.data.pubs;
|
||||
} else if (key == 'apps') {
|
||||
g_data.apps = event.data.apps;
|
||||
} else if (key == 'votes') {
|
||||
event.data.votes.forEach(function(vote) {
|
||||
var link = JSON.parse(vote.content).vote.link;
|
||||
if (!g_data.votes[link]) {
|
||||
Vue.set(g_data.votes, link, []);
|
||||
}
|
||||
g_data.votes[link].push(vote);
|
||||
});
|
||||
} else if (key == 'clear') {
|
||||
Object.keys(g_data_initial).forEach(function(key) {
|
||||
Vue.set(g_data, key, JSON.parse(JSON.stringify(g_data_initial[key])));
|
||||
|
Reference in New Issue
Block a user