Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
d0e75278
Commit
d0e75278
authored
Jan 19, 2015
by
Aron Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up emit function and bindings
parent
8561e2f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
cross-frame-sync.coffee
h/static/scripts/cross-frame-sync.coffee
+8
-15
No files found.
h/static/scripts/cross-frame-sync.coffee
View file @
d0e75278
...
...
@@ -70,55 +70,48 @@ class CrossFrameSync
destructor
:
=>
$
(
window
).
off
'message'
,
this
.
_onMessage
_emit
:
(
event
)
->
@
$rootScope
.
$emit
(
event
,
argument
s
)
_emit
:
(
args
...
)
->
@
$rootScope
.
$emit
.
apply
(
@
$rootScope
,
arg
s
)
bind_channel_listeners
:
(
channel
)
->
# Channel message --> trigger events on $rootScope
channel
.
bind
(
'beforeCreateAnnotation'
,
(
txn
,
annotation
)
=>
channel
.
bind
'beforeCreateAnnotation'
,
(
txn
,
annotation
)
=>
annotation
=
this
.
_parse
annotation
delete
@
cache
[
annotation
.
$
$tag
]
@
_emit
'beforeAnnotationCreated'
,
annotation
@
cache
[
annotation
.
$
$tag
]
=
annotation
this
.
_format
annotation
)
.
bind
(
'createAnnotation'
,
(
txn
,
annotation
)
=>
channel
.
bind
'createAnnotation'
,
(
txn
,
annotation
)
=>
annotation
=
this
.
_parse
annotation
delete
@
cache
[
annotation
.
$
$tag
]
@
_emit
'annotationCreated'
,
annotation
@
cache
[
annotation
.
$
$tag
]
=
annotation
this
.
_format
annotation
)
.
bind
(
'updateAnnotation'
,
(
txn
,
annotation
)
=>
channel
.
bind
'updateAnnotation'
,
(
txn
,
annotation
)
=>
annotation
=
this
.
_parse
annotation
delete
@
cache
[
annotation
.
$
$tag
]
@
_emit
(
'beforeAnnotationUpdated'
,
[
annotation
])
@
_emit
(
'annotationUpdated'
,
[
annotation
])
@
cache
[
annotation
.
$
$tag
]
=
annotation
this
.
_format
annotation
)
.
bind
(
'deleteAnnotation'
,
(
txn
,
annotation
)
=>
channel
.
bind
'deleteAnnotation'
,
(
txn
,
annotation
)
=>
annotation
=
this
.
_parse
annotation
delete
@
cache
[
annotation
.
$
$tag
]
@
_emit
(
'annotationDeleted'
,
[
annotation
])
res
=
this
.
_format
annotation
delete
@
cache
[
annotation
.
$
$tag
]
res
)
.
bind
(
'sync'
,
(
ctx
,
annotations
)
=>
channel
.
bind
'sync'
,
(
ctx
,
annotations
)
=>
(
this
.
_format
(
this
.
_parse
a
)
for
a
in
annotations
)
)
## Notifications
.
bind
(
'loadAnnotations'
,
(
txn
,
annotations
)
=>
channel
.
bind
'loadAnnotations'
,
(
txn
,
annotations
)
=>
annotations
=
(
this
.
_parse
a
for
a
in
annotations
)
@
_emit
(
'loadAnnotations'
,
annotations
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment