This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function countDown(start, end, item) { | |
var startFrom = start; | |
var timer = setInterval(function(){ | |
startFrom += 1; | |
item.innerHTML = startFrom; | |
if(startFrom >= end){clearInterval(timer)} | |
}, 10); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var debounce = function (f, ms){ | |
var state = null; | |
var COOLDOWN = 1; | |
return function(){ | |
if(state) return; | |
f.apply(this. arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CoffeMachine(power){ | |
const _this = this; //Сохранение контекста для обрращения к нему из внутренних функций | |
//Set water amount | |
this.waterAmount = 0; | |
const WATER_HEAT_CAPACITY = 4200; | |
var timerId; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coffie machine constructor | |
//=================================================================== | |
function CoffeMachine(power, capacity){ | |
//Define private vars //Сохранение контекста для обрращения к нему из внутренних функций | |
const WATER_HEAT_CAPACITY = 4200; | |
const POWER = power; | |
var timerId; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Prototype inheritance | |
//=================================================================== | |
function Machine (power) { | |
var self = this; | |
self._enabled = false; | |
this._power = power; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('element').bind('DOMMouseScroll mousewheel', function(e){ | |
event.preventDefault(); | |
if(e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0) { | |
//Actions | |
} | |
else{ | |
//Actions | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.laze require => | |
Ленивая загрузка модулей - при загрузке отсутствующего модуля, lazyequire загрузит его | |
gulp_tasks/config/index.js - лежит основной конфиг проета |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************* | |
* | |
* Strategy | |
* | |
**********************************************/ | |
const weapons = { | |
sword: { | |
'name': 'Excalibur', | |
'damage': 20 |
OlderNewer