Commit 2903ec8f authored by Ujvari Gergely's avatar Ujvari Gergely Committed by Randall Leeds

Handling realtime updates (no animation just yet)

parent 10e65d85
...@@ -424,15 +424,25 @@ class App ...@@ -424,15 +424,25 @@ class App
user = if p? then "acct:" + p.username + "@" + p.provider else '' user = if p? then "acct:" + p.username + "@" + p.provider else ''
unless data instanceof Array then data = [data] unless data instanceof Array then data = [data]
$scope.$apply => $scope.$apply =>
if $scope.socialView.name is 'single-player' if data.length > 0 then $scope.new_updates += 1
owndata = data.filter (d) -> d.user is user
if action is 'create' if $scope.socialView.name is 'single-player'
if annotator.plugins.Store? owndata = data.filter (d) -> d.user is user
annotator.plugins.Store._onLoadAnnotations owndata $scope.applyUpdates action, owndata
else else
if action is 'create' $scope.applyUpdates action, data
if annotator.plugins.Store?
annotator.plugins.Store._onLoadAnnotations data $scope.applyUpdates = (action, data) =>
switch action
when 'create'
$scope.$apply =>
if annotator.plugins.Store?
annotator.plugins.Store._onLoadAnnotations data
when 'update'
if annotator.plugins.Store?
annotator.plugins.Store._onLoadAnnotations data
when 'delete'
console.log 'deleted'
$timeout => $timeout =>
$scope.initUpdater() $scope.initUpdater()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment