mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-14 06:20:47 +00:00
update
This commit is contained in:
24
node_modules/bs-recipes/recipes/webpack.monkey-hot-loader/app/main.js
generated
vendored
Normal file
24
node_modules/bs-recipes/recipes/webpack.monkey-hot-loader/app/main.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
function inc(value) { // Play with me
|
||||
return value + 1;
|
||||
}
|
||||
|
||||
function dec(value) { // and me
|
||||
return value - 1;
|
||||
}
|
||||
|
||||
// IMPORTANT: it won't work as expected if you'll use addEventListener
|
||||
// or $(document).ready as it will bind events again and again...
|
||||
// So you may need some workaround for this or split modules in a particular way
|
||||
window.onload = function() {
|
||||
var number = document.getElementById('number');
|
||||
var incBtn = document.getElementById('inc');
|
||||
var decBtn = document.getElementById('dec');
|
||||
|
||||
incBtn.addEventListener('click', function() {
|
||||
number.innerHTML = inc(+number.innerHTML);
|
||||
}, false);
|
||||
|
||||
decBtn.addEventListener('click', function() {
|
||||
number.innerHTML = dec(+number.innerHTML);
|
||||
}, false);
|
||||
};
|
Reference in New Issue
Block a user