I ran into a JS code I want to use and I don't understand some parts of it. I use the pycharm environment to edit it. The source of the code is the following: https://github.com/ErmiyaEskandary/Slither.io-bot
For example, in this part of the code:
var canvasUtil = window.canvasUtil = (function() {
return {
// Ratio of screen size divided by canvas size.
canvasRatio: {
x: window.mc.width / window.ww,
y: window.mc.height / window.hh
},
// Set direction of snake towards the virtual mouse coordinates
setMouseCoordinates: function(point) {
window.xm = point.x;
window.ym = point.y;
},
I don't understand what the "window" object is, and where it's defined. when I tried to find it's definition I got to a file named DHTML.js, where the only defenition for window there was:
/**
@type {Window}
*/
Window.prototype.window = 0;
or
/**
@type {Window}
@const
*/
window = 0;
(This file is not a part of the repository)
Do you know what this window object is? can you explain how does it work? and where can I find more information about it? In the code - what does window.mc, for example, means? I didn't found any information about the window's property. There are similar objects in the code like window but this one appears the most.
(I tried to look it up but the information I found in w3schools doesn't seems to be related: https://www.w3schools.com/jsref/obj_window.asp)