Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Eye-Tracking Classroom
/
gaze-client.js
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5a1ac23e
authored
Aug 27, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix event type in data listener
parent
d05dc0a4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
7 deletions
+7
-7
build/gazeclient.js
+1
-1
build/gazeclient.js.map
+0
-0
build/gazeclient.min.js
+2
-2
demo/gazeclient.min.js
+2
-2
demo/resources/js/index.js
+1
-1
lib/index.js
+1
-1
No files found.
build/gazeclient.js
View file @
5a1ac23e
...
...
@@ -107,7 +107,7 @@
this
.
client
.
addEventListener
(
"connectionopened"
,
this
.
onConnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"connectionclosed"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"erroroccurred"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"data
A
vailable"
,
this
.
onDataAvailable
this
.
client
.
addEventListener
(
"data
a
vailable"
,
this
.
onDataAvailable
.
bind
(
this
));
this
.
client
.
connect
(
url
);
}
...
...
build/gazeclient.js.map
View file @
5a1ac23e
This diff is collapsed.
Click to expand it.
build/gazeclient.min.js
View file @
5a1ac23e
(
function
(){
"use strict"
;
class
Observable
{
constructor
(){
this
.
listeners
=
{}}
addEventListener
(
type
,
callback
){
if
(
this
.
listeners
[
type
]
===
undefined
){
this
.
listeners
[
type
]
=
[]}
this
.
listeners
[
type
].
push
(
callback
)}
notifyAll
(
event
){
let
listeners
=
this
.
listeners
[
event
.
type
];
if
(
listeners
){
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
){
listeners
[
i
](
event
)}}}}
class
Event
{
constructor
(
type
,
data
){
this
.
type
=
type
;
this
.
data
=
data
}}
class
DataEvent
extends
Event
{
constructor
(
data
){
super
(
"dataavailable"
,
data
)}}
class
ConnectionOpenedEvent
extends
Event
{
constructor
(){
super
(
"connectionopened"
)}}
class
ConnectionClosedEvent
extends
Event
{
constructor
(){
super
(
"connectionclosed"
)}}
class
ConnectionErrorEvent
extends
Event
{
constructor
(){
super
(
"erroroccurred"
)}}
class
WebSocketClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
ws
=
new
WebSocket
(
url
);
this
.
ws
.
onopen
=
onOpen
.
bind
(
this
);
this
.
ws
.
onclose
=
onClose
.
bind
(
this
);
this
.
ws
.
onerror
=
onError
.
bind
(
this
);
this
.
ws
.
onmessage
=
onMessage
.
bind
(
this
)}}
function
onOpen
(){
let
connectionEvent
=
new
ConnectionOpenedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onClose
(){
let
connectionEvent
=
new
ConnectionClosedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onError
(){
let
connectionEvent
=
new
ConnectionErrorEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onMessage
(
event
){
let
dataEvent
=
new
DataEvent
(
event
.
data
);
this
.
notifyAll
(
dataEvent
)}
class
GazeClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
url
=
url
;
this
.
client
=
new
WebSocketClient
;
this
.
client
.
addEventListener
(
"connectionopened"
,
this
.
onConnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"connectionclosed"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"erroroccurred"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"dataAvailable"
,
this
.
onDataAvailable
.
bind
(
this
));
this
.
client
.
connect
(
url
)}
onConnected
(
event
){
this
.
notifyAll
(
event
)}
onDisconnected
(
event
){
this
.
notifyAll
(
event
)}
onError
(
event
){
this
.
notifyAll
(
event
)}
onDataAvailable
(
event
){
this
.
notifyAll
(
event
)}}
window
.
GazeClient
=
GazeClient
})();
\ No newline at end of file
(
function
(){
"use strict"
;
class
Observable
{
constructor
(){
this
.
listeners
=
{}}
addEventListener
(
type
,
callback
){
if
(
this
.
listeners
[
type
]
===
undefined
){
this
.
listeners
[
type
]
=
[]}
this
.
listeners
[
type
].
push
(
callback
)}
notifyAll
(
event
){
let
listeners
=
this
.
listeners
[
event
.
type
];
if
(
listeners
){
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
){
listeners
[
i
](
event
)}}}}
class
Event
{
constructor
(
type
,
data
){
this
.
type
=
type
;
this
.
data
=
data
}}
class
DataEvent
extends
Event
{
constructor
(
data
){
super
(
"dataavailable"
,
data
)}}
class
ConnectionOpenedEvent
extends
Event
{
constructor
(){
super
(
"connectionopened"
)}}
class
ConnectionClosedEvent
extends
Event
{
constructor
(){
super
(
"connectionclosed"
)}}
class
ConnectionErrorEvent
extends
Event
{
constructor
(){
super
(
"erroroccurred"
)}}
class
WebSocketClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
ws
=
new
WebSocket
(
url
);
this
.
ws
.
onopen
=
onOpen
.
bind
(
this
);
this
.
ws
.
onclose
=
onClose
.
bind
(
this
);
this
.
ws
.
onerror
=
onError
.
bind
(
this
);
this
.
ws
.
onmessage
=
onMessage
.
bind
(
this
)}}
function
onOpen
(){
let
connectionEvent
=
new
ConnectionOpenedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onClose
(){
let
connectionEvent
=
new
ConnectionClosedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onError
(){
let
connectionEvent
=
new
ConnectionErrorEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onMessage
(
event
){
let
dataEvent
=
new
DataEvent
(
event
.
data
);
this
.
notifyAll
(
dataEvent
)}
class
GazeClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
url
=
url
;
this
.
client
=
new
WebSocketClient
;
this
.
client
.
addEventListener
(
"connectionopened"
,
this
.
onConnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"connectionclosed"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"erroroccurred"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"dataavailable"
,
this
.
onDataAvailable
.
bind
(
this
));
this
.
client
.
connect
(
url
)}
onConnected
(
event
){
this
.
notifyAll
(
event
)}
onDisconnected
(
event
){
this
.
notifyAll
(
event
)}
onError
(
event
){
this
.
notifyAll
(
event
)}
onDataAvailable
(
event
){
this
.
notifyAll
(
event
)}}
window
.
GazeClient
=
GazeClient
})();
\ No newline at end of file
demo/gazeclient.min.js
View file @
5a1ac23e
(
function
(){
"use strict"
;
class
Observable
{
constructor
(){
this
.
listeners
=
{}}
addEventListener
(
type
,
callback
){
if
(
this
.
listeners
[
type
]
===
undefined
){
this
.
listeners
[
type
]
=
[]}
this
.
listeners
[
type
].
push
(
callback
)}
notifyAll
(
event
){
let
listeners
=
this
.
listeners
[
event
.
type
];
if
(
listeners
){
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
){
listeners
[
i
](
event
)}}}}
class
Event
{
constructor
(
type
,
data
){
this
.
type
=
type
;
this
.
data
=
data
}}
class
DataEvent
extends
Event
{
constructor
(
data
){
super
(
"dataavailable"
,
data
)}}
class
ConnectionOpenedEvent
extends
Event
{
constructor
(){
super
(
"connectionopened"
)}}
class
ConnectionClosedEvent
extends
Event
{
constructor
(){
super
(
"connectionclosed"
)}}
class
ConnectionErrorEvent
extends
Event
{
constructor
(){
super
(
"erroroccurred"
)}}
class
WebSocketClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
ws
=
new
WebSocket
(
url
);
this
.
ws
.
onopen
=
onOpen
.
bind
(
this
);
this
.
ws
.
onclose
=
onClose
.
bind
(
this
);
this
.
ws
.
onerror
=
onError
.
bind
(
this
);
this
.
ws
.
onmessage
=
onMessage
.
bind
(
this
)}}
function
onOpen
(){
let
connectionEvent
=
new
ConnectionOpenedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onClose
(){
let
connectionEvent
=
new
ConnectionClosedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onError
(){
let
connectionEvent
=
new
ConnectionErrorEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onMessage
(
event
){
let
dataEvent
=
new
DataEvent
(
event
.
data
);
this
.
notifyAll
(
dataEvent
)}
class
GazeClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
url
=
url
;
this
.
client
=
new
WebSocketClient
;
this
.
client
.
addEventListener
(
"connectionopened"
,
this
.
onConnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"connectionclosed"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"erroroccurred"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"dataAvailable"
,
this
.
onDataAvailable
.
bind
(
this
));
this
.
client
.
connect
(
url
)}
onConnected
(
event
){
this
.
notifyAll
(
event
)}
onDisconnected
(
event
){
this
.
notifyAll
(
event
)}
onError
(
event
){
this
.
notifyAll
(
event
)}
onDataAvailable
(
event
){
this
.
notifyAll
(
event
)}}
window
.
GazeClient
=
GazeClient
})();
\ No newline at end of file
(
function
(){
"use strict"
;
class
Observable
{
constructor
(){
this
.
listeners
=
{}}
addEventListener
(
type
,
callback
){
if
(
this
.
listeners
[
type
]
===
undefined
){
this
.
listeners
[
type
]
=
[]}
this
.
listeners
[
type
].
push
(
callback
)}
notifyAll
(
event
){
let
listeners
=
this
.
listeners
[
event
.
type
];
if
(
listeners
){
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
){
listeners
[
i
](
event
)}}}}
class
Event
{
constructor
(
type
,
data
){
this
.
type
=
type
;
this
.
data
=
data
}}
class
DataEvent
extends
Event
{
constructor
(
data
){
super
(
"dataavailable"
,
data
)}}
class
ConnectionOpenedEvent
extends
Event
{
constructor
(){
super
(
"connectionopened"
)}}
class
ConnectionClosedEvent
extends
Event
{
constructor
(){
super
(
"connectionclosed"
)}}
class
ConnectionErrorEvent
extends
Event
{
constructor
(){
super
(
"erroroccurred"
)}}
class
WebSocketClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
ws
=
new
WebSocket
(
url
);
this
.
ws
.
onopen
=
onOpen
.
bind
(
this
);
this
.
ws
.
onclose
=
onClose
.
bind
(
this
);
this
.
ws
.
onerror
=
onError
.
bind
(
this
);
this
.
ws
.
onmessage
=
onMessage
.
bind
(
this
)}}
function
onOpen
(){
let
connectionEvent
=
new
ConnectionOpenedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onClose
(){
let
connectionEvent
=
new
ConnectionClosedEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onError
(){
let
connectionEvent
=
new
ConnectionErrorEvent
;
this
.
notifyAll
(
connectionEvent
)}
function
onMessage
(
event
){
let
dataEvent
=
new
DataEvent
(
event
.
data
);
this
.
notifyAll
(
dataEvent
)}
class
GazeClient
extends
Observable
{
constructor
(){
super
()}
connect
(
url
){
this
.
url
=
url
;
this
.
client
=
new
WebSocketClient
;
this
.
client
.
addEventListener
(
"connectionopened"
,
this
.
onConnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"connectionclosed"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"erroroccurred"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"dataavailable"
,
this
.
onDataAvailable
.
bind
(
this
));
this
.
client
.
connect
(
url
)}
onConnected
(
event
){
this
.
notifyAll
(
event
)}
onDisconnected
(
event
){
this
.
notifyAll
(
event
)}
onError
(
event
){
this
.
notifyAll
(
event
)}
onDataAvailable
(
event
){
this
.
notifyAll
(
event
)}}
window
.
GazeClient
=
GazeClient
})();
\ No newline at end of file
demo/resources/js/index.js
View file @
5a1ac23e
...
...
@@ -4,7 +4,7 @@
var
gclient
=
new
GazeClient
();
gclient
.
connect
(
"ws://localhost:8001/gaze"
);
gclient
.
addEventListener
(
"connectionopened"
,
onConnected
);
gclient
.
addEventListener
(
"data
A
vailable"
,
onGazeDataAvailable
);
gclient
.
addEventListener
(
"data
a
vailable"
,
onGazeDataAvailable
);
gclient
.
addEventListener
(
"connectionclosed"
,
onDisconnected
);
function
onConnected
(
event
)
{
...
...
lib/index.js
View file @
5a1ac23e
...
...
@@ -13,7 +13,7 @@ class GazeClient extends Observable {
this
.
client
.
addEventListener
(
"connectionopened"
,
this
.
onConnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"connectionclosed"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"erroroccurred"
,
this
.
onDisconnected
.
bind
(
this
));
this
.
client
.
addEventListener
(
"data
A
vailable"
,
this
.
onDataAvailable
this
.
client
.
addEventListener
(
"data
a
vailable"
,
this
.
onDataAvailable
.
bind
(
this
));
this
.
client
.
connect
(
url
);
}
...
...
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