| 123456789101112131415161718192021222324252627282930313233343536373839 | 
							- function Timer(callback, delay, paused) {
 
- 	let timerId, start, remaining = delay;
 
- 	let timeWhenPaused = 0;
 
- 	const timePaused = Date.now();
 
- 	this.pause = () => {
 
- 		clearTimeout(timerId);
 
- 		remaining -= Date.now() - start;
 
- 		timePaused = Date.now();
 
- 	};
 
- 	this.resume = () => {
 
- 		start = Date.now();
 
- 		clearTimeout(timerId);
 
- 		timerId = setTimeout(callback, remaining);
 
- 		timeWhenPaused += Date.now() - timePaused;
 
- 	};
 
- 	this.resetTimeWhenPaused = () => {
 
- 		timeWhenPaused = 0;
 
- 	};
 
- 	this.timeWhenPaused = () => {
 
- 		return timeWhenPaused;
 
- 	};
 
- 	if (paused === false) {
 
- 		this.resume();
 
- 	}
 
- }
 
- module.exports = {
 
- 	io: null, // Socket.io
 
- 	db: null, // Database
 
- 	htmlEntities: function(str) {
 
- 		return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
 
- 	},
 
- 	Timer
 
- };
 
 
  |