@elvia/elvis-toolbox
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -1,47 +0,35 @@ | ||
/* | ||
* THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN. | ||
* DO NOT MAKE CHANGES TO THIS FILE DIRECTLY | ||
*/ | ||
import * as lodashThrottle from 'lodash.throttle'; | ||
const throttle = (func, limit, options) => { | ||
return lodashThrottle(func, limit, options); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var customThrottle = function (func, limit, options) { | ||
return (0, lodash_1.throttle)(func, limit, options); | ||
}; | ||
const outlineListener = (element, destroy) => { | ||
if (!element) { | ||
return; | ||
} | ||
const addOutline = e => { | ||
if (e.key === 'Tab' && element.classList.contains('ewc-no-outline')) { | ||
element.classList.remove('ewc-no-outline'); // Add mousedown event-listener to remove outline again | ||
element.addEventListener('mousedown', removeOutline, false); | ||
var outlineListener = function (element, destroy) { | ||
if (!element) { | ||
return; | ||
} | ||
}; | ||
const removeOutline = () => { | ||
if (!element.classList.contains('ewc-no-outline')) { | ||
element.classList.add('ewc-no-outline'); // Remove mousedown event-listener until next tab happens | ||
element.removeEventListener('mousedown', removeOutline, false); | ||
var addOutline = function (e) { | ||
if (e.key === 'Tab' && element.classList.contains('ewc-no-outline')) { | ||
element.classList.remove('ewc-no-outline'); | ||
// Add mousedown event-listener to remove outline again | ||
element.addEventListener('mousedown', removeOutline, false); | ||
} | ||
}; | ||
var removeOutline = function () { | ||
if (!element.classList.contains('ewc-no-outline')) { | ||
element.classList.add('ewc-no-outline'); | ||
// Remove mousedown event-listener until next tab happens | ||
element.removeEventListener('mousedown', removeOutline, false); | ||
} | ||
}; | ||
// If destroy is true -> Remove all listeners and return | ||
if (destroy) { | ||
element.removeEventListener('keydown', addOutline); | ||
element.removeEventListener('mousedown', removeOutline, false); | ||
return; | ||
} | ||
}; // If destroy is true -> Remove all listeners and return | ||
if (destroy) { | ||
element.removeEventListener('keydown', addOutline); | ||
element.removeEventListener('mousedown', removeOutline, false); | ||
return; | ||
} // Start listening for keyboard-events and mousedown on element to add or remove outline | ||
element.addEventListener('keydown', addOutline); | ||
element.addEventListener('mousedown', removeOutline, false); | ||
// Start listening for keyboard-events and mousedown on element to add or remove outline | ||
element.addEventListener('keydown', addOutline); | ||
element.addEventListener('mousedown', removeOutline, false); | ||
}; | ||
export default { | ||
throttle: throttle, | ||
outlineListener: outlineListener | ||
}; | ||
exports.default = { throttle: customThrottle, outlineListener: outlineListener }; |
{ | ||
"name": "@elvia/elvis-toolbox", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "", | ||
"license": "MIT", | ||
"author": "", | ||
"main": "./dist/elvis-toolbox.js", | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"lodash.throttle": "^4.1.1" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash.throttle": "^4.1.6" | ||
} | ||
} |
@@ -1,8 +0,8 @@ | ||
import * as lodashThrottle from 'lodash.throttle'; | ||
import { throttle } from 'lodash'; | ||
const throttle = (func: () => void, limit: number, options: { trailing: boolean }): void => { | ||
return lodashThrottle(func, limit, options); | ||
const customThrottle = (func: () => void, limit: number, options?: { trailing: boolean }): any => { | ||
return throttle(func, limit, options); | ||
}; | ||
const outlineListener = (element: HTMLElement, destroy?: boolean): void => { | ||
const outlineListener = (element: HTMLElement | null, destroy?: boolean): void => { | ||
if (!element) { | ||
@@ -40,2 +40,2 @@ return; | ||
export default { throttle: throttle, outlineListener: outlineListener }; | ||
export default { throttle: customThrottle, outlineListener: outlineListener }; |
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
3635
5
75
1