MCPcopy Create free account
hub / github.com/microsoft/SandDance / KeyInput

Function KeyInput

docs/tests/v2/es6/js/sanddance.js:54503–54522  ·  view source on GitHub ↗
(element, callback)

Source from the content-addressed store, hash-verified

54501
54502var KeyInput = function () {
54503 function KeyInput(element, callback) {
54504 var _this = this;
54505
54506 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
54507 (0, _classCallCheck2.default)(this, KeyInput);
54508 this.element = element;
54509 this.callback = callback;
54510 this.options = Object.assign({
54511 enable: true
54512 }, options);
54513 this.enableDownEvent = this.options.enable;
54514 this.enableUpEvent = this.options.enable;
54515 this.events = KEY_EVENTS.concat(options.events || []);
54516 this.handleEvent = this.handleEvent.bind(this);
54517 element.tabIndex = 1;
54518 element.style.outline = 'none';
54519 this.events.forEach(function (event) {
54520 return element.addEventListener(event, _this.handleEvent);
54521 });
54522 }
54523
54524 (0, _createClass2.default)(KeyInput, [{
54525 key: "destroy",

Callers

nothing calls this directly

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected