gd-app-install 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gd-app-install might be problematic. Click here for more details.
- package/package.json +11 -0
- package/src/debounce.ts +24 -0
- package/src/extend.ts +25 -0
- package/src/index.ts +3 -0
package/package.json
ADDED
package/src/debounce.ts
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
export function(func, delay) {
|
2
|
+
var timeout;
|
3
|
+
|
4
|
+
return function() {
|
5
|
+
var context = this,
|
6
|
+
args = arguments;
|
7
|
+
|
8
|
+
if (timeout) {
|
9
|
+
// We're in the delay period. Clear old timeout (this is the actual debounce) and set a new one.
|
10
|
+
clearTimeout(timeout);
|
11
|
+
timeout = setTimeout(function() {
|
12
|
+
timeout = null;
|
13
|
+
func.apply(context, args);
|
14
|
+
}, delay);
|
15
|
+
}
|
16
|
+
else {
|
17
|
+
// No delay! Set a no-op timeout to start the delay clock.
|
18
|
+
func.apply(context, args);
|
19
|
+
timeout = setTimeout(function() {
|
20
|
+
timeout = null;
|
21
|
+
}, delay);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
}
|
package/src/extend.ts
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
export function extend(out) {
|
2
|
+
out = out || {};
|
3
|
+
|
4
|
+
for (var i = 1; i < arguments.length; i++) {
|
5
|
+
var obj = arguments[i];
|
6
|
+
|
7
|
+
if (!obj) {
|
8
|
+
continue;
|
9
|
+
}
|
10
|
+
|
11
|
+
for (var key in obj) {
|
12
|
+
if (obj.hasOwnProperty(key)) {
|
13
|
+
if (typeof obj[key] === 'object') {
|
14
|
+
var cpy = out[key];
|
15
|
+
out[key] = extend(cpy, obj[key]);
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
out[key] = obj[key];
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
return out;
|
25
|
+
}
|
package/src/index.ts
ADDED