game: add: class: point and segment, add: type docstring
This commit is contained in:
30
frontend/static/js/api/game/Point.js
Normal file
30
frontend/static/js/api/game/Point.js
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
class Point
|
||||
{
|
||||
/**
|
||||
* @param {Number} x
|
||||
* @param {Number} y
|
||||
*/
|
||||
constructor(x, y)
|
||||
{
|
||||
/**
|
||||
* @type {Number}
|
||||
*/
|
||||
this.x = x;
|
||||
/**
|
||||
* @type {Number}
|
||||
*/
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
from_json(data)
|
||||
{
|
||||
this.x = data.x
|
||||
this.y = data.y
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
export { Point }
|
Reference in New Issue
Block a user