File tree 4 files changed +42
-4
lines changed 4 files changed +42
-4
lines changed Original file line number Diff line number Diff line change
1
+ # Changelog
2
+
3
+ ## v1.1.0
4
+ (16/07/2017)
5
+
6
+ * Will now reconnect when the websocket is closed.
7
+
8
+ ## v1.0.4
9
+ (07/03/2017)
10
+
11
+ * Secure websockets now supported.
12
+
13
+ ## v1.0.3
14
+ (07/03/2017)
15
+
16
+ * Websocket connection will now use correct hostname.
17
+
18
+ ## v1.0.2
19
+ (07/03/2017)
20
+
21
+ * Added dist directory to npm release.
22
+
23
+ ## v1.0.1
24
+ (05/03/2017)
25
+
26
+ * Documentation updated.
27
+
28
+ ## v1.0.0
29
+ (05/03/2017)
30
+
31
+ * Initial release
Original file line number Diff line number Diff line change 5
5
6
6
Tiny browser web framework, which communicates to the server via a websocket. All DOM changes are performed using HTML provided by the server.
7
7
8
- Minified size is ** 2.32 ** Kb which when transmitted compressed is ** 883 ** Bytes!
8
+ Minified size is ** 2.56 ** Kb which when transmitted compressed is ** 945 ** Bytes!
9
9
10
10
## Usage
11
11
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " tiny-browser-framework" ,
3
3
"description" : " Minimal Client JS Framework" ,
4
- "version" : " 1.0.4 " ,
4
+ "version" : " 1.1.0 " ,
5
5
"homepage" : " https://github.com/thedumbterminal/TinyBrowserFramework" ,
6
6
"author" : {
7
7
"name" : " thedumbterminal" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ TBF.prototype._setupWebsocket = function(){
9
9
var socketUrl = window . location . protocol . replace ( 'http' , 'ws' ) + '//' + window . location . host + '/websocket' ;
10
10
this . _websocket = new WebSocket ( socketUrl ) ;
11
11
var self = this ;
12
+ this . _websocket . onclose = function ( event ) {
13
+ setTimeout ( function ( ) {
14
+ self . _websocket . readyState > 1 && self . _setupWebsocket ( ) ;
15
+ } , 1000 )
16
+ }
12
17
this . _websocket . onmessage = function ( event ) {
13
18
var jsons = JSON . parse ( event . data ) ;
14
19
jsons . forEach ( function ( json ) {
@@ -24,9 +29,8 @@ TBF.prototype._augmentInterface = function(){
24
29
}
25
30
tags = document . getElementsByTagName ( 'FORM' ) ;
26
31
for ( var i = 0 ; i < tags . length ; i ++ ) {
27
- this . _augmentForm ( tags . item ( i ) )
32
+ this . _augmentForm ( tags . item ( i ) ) ;
28
33
}
29
-
30
34
} ;
31
35
32
36
TBF . prototype . _augmentButton = function ( ele ) {
@@ -105,6 +109,9 @@ TBF.prototype._setupListeners = function(){
105
109
document . addEventListener ( 'DOMSubtreeModified' , function ( event ) {
106
110
self . _augmentInterface ( ) ;
107
111
} ) ;
112
+ window . onbeforeunload = function ( ) {
113
+ self . _websocket && self . _websocket . close ( ) ;
114
+ } ;
108
115
} ;
109
116
110
117
window . tbfInstance = new TBF ( ) ;
You can’t perform that action at this time.
0 commit comments