Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const formattedListener = function formattedListener(type, keysString) {
const keys = keysString !== undefined ? keysString.split('+') : [];
validateKeys(keys);
return listenerName(type, keys);
};
export function handleKeyEventWithLaxPriorities(event, sortedResponders) {
let currentPriorityLevel;
let noFirstResponders = true;
let isLax = true;
const keys = gatherKeys(event);
const listenerNames = [listenerName(event.type)];
if (keys.length > 0) listenerNames.unshift(listenerName(event.type, keys));
sortedResponders.every((responder) => {
const keyboardFirstResponder = get(responder, 'keyboardFirstResponder');
const keyboardPriority = get(responder, 'keyboardPriority');
if (keyboardFirstResponder || (noFirstResponders && keyboardPriority >= currentPriorityLevel) || isLax) {
if (!get(responder, 'keyboardLaxPriority')) {
isLax = false;
}
if (keyboardFirstResponder) {
if (!isLax) { noFirstResponders = false; }
} else {
currentPriorityLevel = keyboardPriority;
}
export function handleKeyEventWithLaxPriorities(event, sortedResponders) {
let currentPriorityLevel;
let noFirstResponders = true;
let isLax = true;
const keys = gatherKeys(event);
const listenerNames = [listenerName(event.type)];
if (keys.length > 0) listenerNames.unshift(listenerName(event.type, keys));
sortedResponders.every((responder) => {
const keyboardFirstResponder = get(responder, 'keyboardFirstResponder');
const keyboardPriority = get(responder, 'keyboardPriority');
if (keyboardFirstResponder || (noFirstResponders && keyboardPriority >= currentPriorityLevel) || isLax) {
if (!get(responder, 'keyboardLaxPriority')) {
isLax = false;
}
if (keyboardFirstResponder) {
if (!isLax) { noFirstResponders = false; }
} else {
currentPriorityLevel = keyboardPriority;
export function handleKeyEventWithPropagation(event, { firstResponders, normalResponders }) {
const keys = gatherKeys(event);
const listenerNames = [listenerName(event.type, keys), listenerName(event.type)];
let isImmediatePropagationStopped = false;
let isPropagationStopped = false;
const ekEvent = {
stopImmediatePropagation() {
isImmediatePropagationStopped = true;
},
stopPropagation() {
isPropagationStopped = true;
}
}
for (const responder of firstResponders) {
for (const listenerName of listenerNames) {
responder.trigger(listenerName, event, ekEvent);
}