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
df09c8f2
Commit
df09c8f2
authored
Jan 16, 2015
by
ujvari
Committed by
Randall Leeds
Jan 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments and fix tests
parent
11430695
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
store-service.coffee
h/static/scripts/store-service.coffee
+14
-0
streamer-service.coffee
h/static/scripts/streamer-service.coffee
+1
-1
streamer-service-test.coffee
tests/js/streamer-service-test.coffee
+1
-0
No files found.
h/static/scripts/store-service.coffee
View file @
df09c8f2
###*
# @ngdoc service
# @name store
#
# @description
# The `store` service handles the backend calls for the restful API.
###
angular
.
module
(
'h'
)
.
service
(
'store'
,
[
'$document'
,
'$http'
,
'$resource'
,
(
$document
,
$http
,
$resource
)
->
# Find any service link tag
svc
=
$document
.
find
(
'link'
)
.
filter
->
@
rel
is
'service'
and
@
type
is
'application/annotatorsvc+json'
.
filter
->
@
href
...
...
@@ -9,10 +18,15 @@ angular.module('h')
store
=
$resolved
:
false
# We call the service_url and the backend api gives back
# the actions and urls it provides.
$promise
:
$http
.
get
(
svc
)
.
finally
->
store
.
$resolved
=
true
.
then
(
response
)
->
for
name
,
actions
of
response
.
data
.
links
# For each action name we configure an ng-resource.
# For the search resource, one URL is given for all actions.
# For the annotations, each action has its own URL.
store
[
name
]
=
$resource
(
actions
.
url
or
svc
,
{},
actions
)
store
])
h/static/scripts/streamer-service.coffee
View file @
df09c8f2
...
...
@@ -5,7 +5,7 @@ ST_CLOSED = 3
###*
# @ngdoc service
# @name
S
treamer
# @name
s
treamer
#
# @property {string} clientId A unique identifier for this client.
#
...
...
tests/js/streamer-service-test.coffee
View file @
df09c8f2
...
...
@@ -97,6 +97,7 @@ describe 'streamer', ->
msg
=
fakeSock
.
send
.
getCall
(
0
).
args
[
0
]
data
=
JSON
.
parse
(
msg
)
assert
.
equal
(
data
.
messageType
,
'client_id'
)
assert
.
equal
(
typeof
data
.
value
,
'string'
)
...
...
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