Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hive-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hive-js
Commits
6c6986fd
Commit
6c6986fd
authored
8 years ago
by
yamadapc
Browse files
Options
Downloads
Patches
Plain Diff
Add setWebSocket method
parent
c33f0edb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/api.js
+9
-2
9 additions, 2 deletions
lib/api.js
src/api.js
+7
-1
7 additions, 1 deletion
src/api.js
test/api.test.js
+7
-0
7 additions, 0 deletions
test/api.test.js
with
23 additions
and
3 deletions
lib/api.js
+
9
−
2
View file @
6c6986fd
...
@@ -79,6 +79,13 @@ var Steem = function (_EventEmitter) {
...
@@ -79,6 +79,13 @@ var Steem = function (_EventEmitter) {
}
}
_createClass
(
Steem
,
[{
_createClass
(
Steem
,
[{
key
:
'
setWebSocket
'
,
value
:
function
setWebSocket
(
url
)
{
this
.
options
.
url
=
url
;
this
.
stop
();
this
.
start
();
}
},
{
key
:
'
start
'
,
key
:
'
start
'
,
value
:
function
start
()
{
value
:
function
start
()
{
var
_this2
=
this
;
var
_this2
=
this
;
...
@@ -106,7 +113,6 @@ var Steem = function (_EventEmitter) {
...
@@ -106,7 +113,6 @@ var Steem = function (_EventEmitter) {
this
.
releases
.
forEach
(
function
(
release
)
{
this
.
releases
.
forEach
(
function
(
release
)
{
return
release
();
return
release
();
});
});
this
.
ws
.
removeEventListener
();
this
.
ws
.
close
();
this
.
ws
.
close
();
delete
this
.
ws
;
delete
this
.
ws
;
delete
this
.
releases
;
delete
this
.
releases
;
...
@@ -326,4 +332,5 @@ _bluebird2.default.promisifyAll(Steem.prototype);
...
@@ -326,4 +332,5 @@ _bluebird2.default.promisifyAll(Steem.prototype);
// Export singleton instance
// Export singleton instance
var
steem
=
new
Steem
();
var
steem
=
new
Steem
();
exports
=
module
.
exports
=
steem
;
exports
=
module
.
exports
=
steem
;
exports
.
Steem
=
Steem
;
exports
.
Steem
=
Steem
;
\ No newline at end of file
exports
.
Steem
.
DEFAULTS
=
DEFAULTS
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/api.js
+
7
−
1
View file @
6c6986fd
...
@@ -44,6 +44,12 @@ class Steem extends EventEmitter {
...
@@ -44,6 +44,12 @@ class Steem extends EventEmitter {
this
.
start
();
this
.
start
();
}
}
setWebSocket
(
url
)
{
this
.
options
.
url
=
url
;
this
.
stop
();
this
.
start
();
}
start
()
{
start
()
{
this
.
startP
=
new
Promise
((
resolve
/* , reject*/
)
=>
{
this
.
startP
=
new
Promise
((
resolve
/* , reject*/
)
=>
{
this
.
ws
=
new
WebSocket
(
this
.
options
.
url
);
this
.
ws
=
new
WebSocket
(
this
.
options
.
url
);
...
@@ -69,7 +75,6 @@ class Steem extends EventEmitter {
...
@@ -69,7 +75,6 @@ class Steem extends EventEmitter {
stop
()
{
stop
()
{
this
.
releases
.
forEach
((
release
)
=>
release
());
this
.
releases
.
forEach
((
release
)
=>
release
());
this
.
ws
.
removeEventListener
();
this
.
ws
.
close
();
this
.
ws
.
close
();
delete
this
.
ws
;
delete
this
.
ws
;
delete
this
.
releases
;
delete
this
.
releases
;
...
@@ -272,3 +277,4 @@ Promise.promisifyAll(Steem.prototype);
...
@@ -272,3 +277,4 @@ Promise.promisifyAll(Steem.prototype);
const
steem
=
new
Steem
();
const
steem
=
new
Steem
();
exports
=
module
.
exports
=
steem
;
exports
=
module
.
exports
=
steem
;
exports
.
Steem
=
Steem
;
exports
.
Steem
=
Steem
;
exports
.
Steem
.
DEFAULTS
=
DEFAULTS
;
This diff is collapsed.
Click to expand it.
test/api.test.js
+
7
−
0
View file @
6c6986fd
...
@@ -12,6 +12,13 @@ describe('steem', function () {
...
@@ -12,6 +12,13 @@ describe('steem', function () {
await
steem
.
apiIdsP
;
await
steem
.
apiIdsP
;
});
});
describe
(
'
setWebSocket
'
,
()
=>
{
it
(
'
works
'
,
()
=>
{
steem
.
setWebSocket
(
'
ws://localhost
'
);
steem
.
setWebSocket
(
steem
.
Steem
.
DEFAULTS
.
url
);
});
});
describe
(
'
getFollowers
'
,
()
=>
{
describe
(
'
getFollowers
'
,
()
=>
{
describe
(
'
getting ned
\'
s followers
'
,
()
=>
{
describe
(
'
getting ned
\'
s followers
'
,
()
=>
{
it
(
'
works
'
,
async
()
=>
{
it
(
'
works
'
,
async
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment