Skip to content

Commit 893c94e

Browse files
committed
- fire close event in sharedb client when socket closed
- document events in sharedb client - bump version
1 parent 9cd862a commit 893c94e

File tree

7 files changed

+21
-6
lines changed

7 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Logs
22

3+
## v0.0.7
4+
5+
- fire `close` event in sharedb client when socket closed
6+
- document events in sharedb client
7+
8+
39
## v0.0.6
410

511
- fix bug: disconnect handler doesn't correctly clean up internal variables

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ create a sdb-client everytime the ews object (re)connected:
6868
sdb.connect().then( ... );
6969
});
7070

71+
Additionally, following events are available in sdb-client:
72+
73+
- `close`: socket is closed.
74+
- `error`: fired when receiving `error` events from sharedb `Doc`
75+
7176

7277
### sdb-server
7378

dist/sdb-client.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
_ws: opt.ws
99
});
1010
this._ws.addEventListener('close', function(){
11-
return this$._connection = null, this$._sws = null, this$;
11+
this$._connection = null;
12+
this$._sws = null;
13+
return this$.fire('close');
1214
});
1315
return this;
1416
};

dist/sdb-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@plotdb/ews",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "elastic websocket",
55
"main": "dist/index.min.js",
66
"browser": "dist/index.min.js",

src/sdb-client.ls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ ews.sdb-client = (opt = {}) ->
33
_evthdr: {}
44
_connection: null # sharedb connection object
55
_ws: opt.ws
6-
@_ws.addEventListener \close, ~> @ <<< _connection: null, _sws: null
6+
@_ws.addEventListener \close, ~>
7+
@ <<< _connection: null, _sws: null
8+
@fire \close
79
@
810

911
ews.sdb-client.prototype = Object.create(Object.prototype) <<< do

0 commit comments

Comments
 (0)