forked from jamesshore/lets_code_javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_pointer_message.js
More file actions
30 lines (23 loc) · 812 Bytes
/
client_pointer_message.js
File metadata and controls
30 lines (23 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2016-2017 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.
(function() {
"use strict";
var ServerPointerMessage = require("./server_pointer_message.js");
var ClientPointerMessage = module.exports = function(x, y) {
this._x = x;
this._y = y;
};
ClientPointerMessage.MESSAGE_NAME = "client_pointer_message";
ClientPointerMessage.prototype.name = function() { return ClientPointerMessage.MESSAGE_NAME; };
ClientPointerMessage.fromPayload = function(obj) {
return new ClientPointerMessage(obj.x, obj.y);
};
ClientPointerMessage.prototype.payload = function() {
return {
x: this._x,
y: this._y
};
};
ClientPointerMessage.prototype.toServerMessage = function(id) {
return new ServerPointerMessage(id, this._x, this._y);
};
}());