This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.
2021-04-02 02:24:13 +03:00

25 lines
583 B
JavaScript

let gestures = {};
export function getHandler(tag) {
if (tag in gestures) return gestures[tag];
throw new Error('No handler for tag ' + tag);
}
export function createGestureHandler(handlerTag, handler) {
if (handlerTag in gestures) {
throw new Error('Handler with tag ' + handlerTag + ' already exists');
}
gestures[handlerTag] = handler;
gestures[handlerTag].handlerTag = handlerTag;
}
export function dropGestureHandler(handlerTag) {
getHandler(handlerTag).destroy();
delete gestures[handlerTag];
}
export function getNodes() {
return { ...gestures };
}