Added Gulp.js for compiling SCSS stylesheets
This commit is contained in:
6
node_modules/just-debounce/.eslintrc
generated
vendored
Normal file
6
node_modules/just-debounce/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": ["prettier"],
|
||||
"rules": {
|
||||
"prettier/prettier": "error"
|
||||
}
|
||||
}
|
3
node_modules/just-debounce/.travis.yml
generated
vendored
Normal file
3
node_modules/just-debounce/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
21
node_modules/just-debounce/LICENSE
generated
vendored
Normal file
21
node_modules/just-debounce/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Michael Hayes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
75
node_modules/just-debounce/README.md
generated
vendored
Normal file
75
node_modules/just-debounce/README.md
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# just-debounce
|
||||
|
||||
just a basic debounce function
|
||||
|
||||
# changes
|
||||
|
||||
- `1.1.0`: added typescript definitions
|
||||
|
||||
# Why?
|
||||
|
||||
I searched npm and the first 3 pages of results for "debounce" did not have a small correctly
|
||||
implemented version of debounce
|
||||
|
||||
# Usage
|
||||
|
||||
### arguments
|
||||
|
||||
- `fn`: the function to debounce
|
||||
- `delay`: debounce delay in ms
|
||||
- `atStart:` if true, the function will be called at the beginning of the delay rather than the end
|
||||
- `guarantee`: additional calls to debounced function will not reset they `delay`. This guarantees
|
||||
that if the function is called frequently, it will fire once every `delay` rather than waiting for
|
||||
a break in calls.
|
||||
|
||||
```javascript
|
||||
var db = require('just-debounce');
|
||||
|
||||
var debounced = db(function (v) {
|
||||
console.log(v);
|
||||
}, 100);
|
||||
|
||||
debounced('hi');
|
||||
debounced('hi');
|
||||
// logs 'hi' once after 100ms
|
||||
```
|
||||
|
||||
```javascript
|
||||
var db = require('just-debounce');
|
||||
|
||||
var debounced = db(
|
||||
function (v) {
|
||||
console.log(v);
|
||||
},
|
||||
100,
|
||||
true
|
||||
);
|
||||
|
||||
debounced('hi');
|
||||
debounced('hi');
|
||||
// logs 'hi' once right away, but not a second time. calling after 100ms will log again
|
||||
```
|
||||
|
||||
```javascript
|
||||
var db = require('just-debounce');
|
||||
|
||||
var debounced = db(
|
||||
function (v) {
|
||||
console.log(v);
|
||||
},
|
||||
100,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
debounced('hi');
|
||||
setTimeout(function () {
|
||||
debounced('hi2');
|
||||
}, 80);
|
||||
|
||||
// logs 'hi2' once 100ms after the first call to debounced
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
8
node_modules/just-debounce/index.d.ts
generated
vendored
Normal file
8
node_modules/just-debounce/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
declare function debounce<T extends (...args: any[]) => void>(
|
||||
fn: T,
|
||||
delay: number,
|
||||
atStart?: boolean,
|
||||
guarantee?: boolean
|
||||
): (...args: Parameters<T>) => void;
|
||||
|
||||
export default debounce;
|
34
node_modules/just-debounce/index.js
generated
vendored
Normal file
34
node_modules/just-debounce/index.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
module.exports = debounce;
|
||||
|
||||
function debounce(fn, delay, atStart, guarantee) {
|
||||
var timeout;
|
||||
var args;
|
||||
var self;
|
||||
|
||||
return function debounced() {
|
||||
self = this;
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
|
||||
if (timeout && (atStart || guarantee)) {
|
||||
return;
|
||||
} else if (!atStart) {
|
||||
clear();
|
||||
|
||||
timeout = setTimeout(run, delay);
|
||||
return timeout;
|
||||
}
|
||||
|
||||
timeout = setTimeout(clear, delay);
|
||||
fn.apply(self, args);
|
||||
|
||||
function run() {
|
||||
clear();
|
||||
fn.apply(self, args);
|
||||
}
|
||||
|
||||
function clear() {
|
||||
clearTimeout(timeout);
|
||||
timeout = null;
|
||||
}
|
||||
};
|
||||
}
|
29
node_modules/just-debounce/package.json
generated
vendored
Normal file
29
node_modules/just-debounce/package.json
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "just-debounce",
|
||||
"version": "1.1.0",
|
||||
"description": "a simple debounce with no dependencies or crazy defaults",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js && npm run lint",
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hayes/just-debounce.git"
|
||||
},
|
||||
"keywords": [
|
||||
"debounce"
|
||||
],
|
||||
"author": "Michael Hayes",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hayes/just-debounce/issues"
|
||||
},
|
||||
"homepage": "https://github.com/hayes/just-debounce",
|
||||
"devDependencies": {
|
||||
"eslint": "^7.20.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"prettier": "^2.2.1",
|
||||
"tape": "^5.1.1"
|
||||
}
|
||||
}
|
13
node_modules/just-debounce/prettier.config.js
generated
vendored
Normal file
13
node_modules/just-debounce/prettier.config.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
arrowParens: 'always',
|
||||
bracketSpacing: true,
|
||||
endOfLine: 'lf',
|
||||
jsxBracketSameLine: false,
|
||||
printWidth: 100,
|
||||
proseWrap: 'always',
|
||||
semi: true,
|
||||
singleQuote: true,
|
||||
tabWidth: 2,
|
||||
trailingComma: 'none',
|
||||
useTabs: false
|
||||
};
|
130
node_modules/just-debounce/test.js
generated
vendored
Normal file
130
node_modules/just-debounce/test.js
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
var debounce = require('./index.js');
|
||||
var test = require('tape');
|
||||
|
||||
test('debauce', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var fn = debounce(function (a, b) {
|
||||
t.deepEqual(this, { call: 3 }, 'context should be preserved');
|
||||
t.equal(a, 30, 'should preserve args');
|
||||
t.equal(b, 300, 'should preserve args');
|
||||
}, 10);
|
||||
|
||||
fn.call({ call: 1 }, 10, 100);
|
||||
fn.call({ call: 2 }, 20, 200);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 3 }, 30, 300);
|
||||
}, 3);
|
||||
});
|
||||
|
||||
test('multiple calls should extend delay', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var wasDelayed = false;
|
||||
|
||||
var fn = debounce(function (a, b) {
|
||||
t.deepEqual(this, { call: 3 }, 'context should be preserved');
|
||||
t.equal(a, 30, 'should preserve args');
|
||||
t.equal(b, 300, 'should preserve args');
|
||||
t.ok(wasDelayed, 'should have waited longer than debounce period');
|
||||
}, 6);
|
||||
|
||||
setTimeout(function longer() {
|
||||
wasDelayed = true;
|
||||
}, 9);
|
||||
|
||||
fn.call({ call: 1 }, 10, 100);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 2 }, 20, 200);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 3 }, 30, 300);
|
||||
}, 5);
|
||||
}, 3);
|
||||
});
|
||||
|
||||
test('multiple calls should not extend delay when guarantee is true', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var first = true;
|
||||
var wasDelayed = false;
|
||||
|
||||
var fn = debounce(
|
||||
function (a, b) {
|
||||
if (first) {
|
||||
t.deepEqual(this, { call: 2 }, '1st context should be preserved');
|
||||
t.equal(a, 20, '1st should preserve 1st args');
|
||||
t.equal(b, 200, '1st should preserve 2nd args');
|
||||
t.notOk(wasDelayed, 'should not have waited longer than debounce period');
|
||||
first = false;
|
||||
} else {
|
||||
t.deepEqual(this, { call: 3 }, 'context should be preserved');
|
||||
t.equal(a, 30, 'should preserve args');
|
||||
t.equal(b, 300, 'should preserve args');
|
||||
t.ok(wasDelayed, 'should have waited longer than debounce period');
|
||||
}
|
||||
},
|
||||
6,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
setTimeout(function longer() {
|
||||
wasDelayed = true;
|
||||
}, 7);
|
||||
|
||||
fn.call({ call: 1 }, 10, 100);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 2 }, 20, 200);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 3 }, 30, 300);
|
||||
}, 5);
|
||||
}, 3);
|
||||
});
|
||||
|
||||
test('at start', function (t) {
|
||||
t.plan(9);
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var fn = debounce(
|
||||
function (a, b) {
|
||||
if (callCount === 0) {
|
||||
t.deepEqual(this, { call: 1 }, '1st context should be preserved');
|
||||
t.equal(a, 10, '1st should preserve 1st args');
|
||||
t.equal(b, 100, '1st should preserve 2nd args');
|
||||
} else if (callCount === 1) {
|
||||
t.deepEqual(this, { call: 3 }, 'context should be preserved');
|
||||
t.equal(a, 30, 'should preserve args');
|
||||
t.equal(b, 300, 'should preserve args');
|
||||
} else {
|
||||
t.deepEqual(this, { call: 4 }, 'context should be preserved');
|
||||
t.equal(a, 40, 'should preserve 1st args');
|
||||
t.equal(b, 400, 'should preserve 2nd args');
|
||||
}
|
||||
|
||||
callCount += 1;
|
||||
},
|
||||
6,
|
||||
true
|
||||
);
|
||||
|
||||
fn.call({ call: 1 }, 10, 100);
|
||||
fn.call({ call: 2 }, 20, 200);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 3 }, 30, 300);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 4 }, 40, 400);
|
||||
}, 10);
|
||||
|
||||
setTimeout(function () {
|
||||
fn.call({ call: 5 }, 50, 500);
|
||||
}, 3);
|
||||
}, 10);
|
||||
});
|
Reference in New Issue
Block a user