Comparing version 0.2.6 to 0.2.7
"use strict"; | ||
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports["default"] = void 0; | ||
var _getObjectValue = _interopRequireDefault(require("get-object-value")); | ||
/** | ||
@@ -15,3 +11,5 @@ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode | ||
var getEventKey = function getEventKey(e) { | ||
return (0, _getObjectValue["default"])(e, ["key"], (0, _getObjectValue["default"])(e, ["keyCode"])); | ||
var _e$key; | ||
return (_e$key = e.key) !== null && _e$key !== void 0 ? _e$key : e.keyCode; | ||
}; | ||
@@ -18,0 +16,0 @@ |
@@ -8,2 +8,6 @@ "use strict"; | ||
var _classCallCheck2 = _interopRequireDefault(require("reshow-runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("reshow-runtime/helpers/createClass")); | ||
var _defineProperty2 = _interopRequireDefault(require("reshow-runtime/helpers/defineProperty")); | ||
@@ -13,4 +17,2 @@ | ||
var _getObjectValue = require("get-object-value"); | ||
var _callfunc = _interopRequireDefault(require("./callfunc")); | ||
@@ -52,2 +54,3 @@ | ||
(0, _classCallCheck2["default"])(this, EventWrap); | ||
(0, _defineProperty2["default"])(this, "optionMap", {}); | ||
@@ -57,3 +60,2 @@ (0, _defineProperty2["default"])(this, "typeMap", {}); | ||
var thisOptId = ++count.opt; | ||
var thisTypeMap = (0, _getObjectValue.initMap)(_this.typeMap)(type, []); | ||
var optionMap = _this.optionMap; | ||
@@ -66,3 +68,9 @@ | ||
optionMap[thisOptId] = [type, func].concat(options); | ||
thisTypeMap.push(thisOptId); | ||
if (!_this.typeMap[type]) { | ||
_this.typeMap[type] = []; | ||
} | ||
_this.typeMap[type].push(thisOptId); | ||
(0, _callfunc["default"])(_this.el.addEventListener, optionMap[thisOptId], _this.el); | ||
@@ -91,3 +99,3 @@ return thisOptId; | ||
var type = thisOptions[0]; | ||
var thisTypeMap = (0, _getObjectValue.initMap)(_this.typeMap)(type, []); | ||
var thisTypeMap = _this.typeMap[type] || []; | ||
_this.typeMap[type] = thisTypeMap.filter(function (item) { | ||
@@ -103,22 +111,22 @@ return item != id; | ||
var _proto = EventWrap.prototype; | ||
(0, _createClass2["default"])(EventWrap, [{ | ||
key: "cleanAll", | ||
value: function cleanAll(type) { | ||
var _this2 = this; | ||
_proto.cleanAll = function cleanAll(type) { | ||
var _this2 = this; | ||
var optionMap = this.optionMap; | ||
var optionMap = this.optionMap; | ||
if (null != type) { | ||
if (this.typeMap[type]) { | ||
this.typeMap[type].forEach(function (key) { | ||
if (null != type) { | ||
if (this.typeMap[type]) { | ||
this.typeMap[type].forEach(function (key) { | ||
_this2.removeEventListener(key); | ||
}); | ||
} | ||
} else { | ||
(0, _reshowConstant.KEYS)(optionMap).forEach(function (key) { | ||
_this2.removeEventListener(key); | ||
}); | ||
} | ||
} else { | ||
(0, _reshowConstant.KEYS)(optionMap).forEach(function (key) { | ||
_this2.removeEventListener(key); | ||
}); | ||
} | ||
}; | ||
}]); | ||
return EventWrap; | ||
@@ -125,0 +133,0 @@ }(); |
{ | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"name": "call-func", | ||
@@ -25,3 +25,2 @@ "repository": { | ||
"css-query-selector": "*", | ||
"get-object-value": "*", | ||
"reshow-constant": "*" | ||
@@ -28,0 +27,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
28317
2
789
3
- Removedget-object-value@*
- Removedget-object-value@0.7.3(transitive)