@github/mini-throttle
Advanced tools
Comparing version 1.0.1 to 1.0.3
export type ThrottleOptions = { | ||
start?: boolean, | ||
middle?: boolean, | ||
/** | ||
* Fire immediately on the first call | ||
*/ | ||
start?: boolean | ||
/** | ||
* If true, fire as soon as `wait` has passed | ||
*/ | ||
middle?: boolean | ||
/** | ||
* Cancel after the first successful call | ||
*/ | ||
once?: boolean | ||
} | ||
export function throttle<T>( | ||
callback: (...args: T[]) => any, | ||
wait: number, | ||
export function throttle<T extends unknown[]>( | ||
callback: (...args: T) => unknown, | ||
wait?: number, | ||
opts?: ThrottleOptions | ||
): (...args: T[]) => void | ||
): ((...args: T) => void) & {cancel(): void} | ||
export function debounce<T>( | ||
callback: (...args: T[]) => any, | ||
wait: number, | ||
export function debounce<T extends unknown[]>( | ||
callback: (...args: T) => unknown, | ||
wait?: number, | ||
opts?: ThrottleOptions | ||
): (...args: T[]) => void | ||
): ((...args: T) => void) & {cancel(): void} |
{ | ||
"name": "@github/mini-throttle", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -23,3 +23,3 @@ "repository": "github.com/github/mini-throttle", | ||
"test": "BABEL_ENV=umd mocha --require @babel/register && npm run tsc", | ||
"tsc": "tsc --noEmit --strict test/index.ts" | ||
"tsc": "tsc --noEmit test/index.ts" | ||
}, | ||
@@ -72,2 +72,20 @@ "babel": { | ||
"plugin:escompat/recommended" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": "test/*", | ||
"rules": { | ||
"no-console": "off" | ||
} | ||
}, | ||
{ | ||
"files": "**.ts", | ||
"parser": "@typescript-eslint/parser", | ||
"rules": { | ||
"import/named": "off", | ||
"import/namespace": "off", | ||
"import/no-deprecated": "off", | ||
"flowtype/require-valid-file-annotation": "off" | ||
} | ||
} | ||
] | ||
@@ -84,2 +102,3 @@ }, | ||
"@babel/register": "^7.4.4", | ||
"@typescript-eslint/parser": "^1.9.0", | ||
"chai": "^4.2.0", | ||
@@ -86,0 +105,0 @@ "eslint": "^5.16.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9882
132
13