@whitesev/utils 2.1.5 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3554,7 +3554,7 @@ System.register('Utils', [], (function (exports) {
3554
3554
  this.windowApi = new WindowApi(option);
3555
3555
  }
3556
3556
  /** 版本号 */
3557
- version = "2024.7.24";
3557
+ version = "2024.8.30";
3558
3558
  addStyle(cssText) {
3559
3559
  if (typeof cssText !== "string") {
3560
3560
  throw new Error("Utils.addStyle 参数cssText 必须为String类型");
@@ -5032,39 +5032,6 @@ System.register('Utils', [], (function (exports) {
5032
5032
  });
5033
5033
  return result;
5034
5034
  }
5035
- listenKeyboard(target, eventName = "keypress", callback, options) {
5036
- if (typeof target !== "object" ||
5037
- (typeof target["addEventListener"] !== "function" &&
5038
- typeof target["removeEventListener"] !== "function")) {
5039
- throw new Error("Utils.listenKeyboard 参数 target 必须为 Window|HTMLElement 类型");
5040
- }
5041
- let keyEvent = function (event) {
5042
- let keyName = event.key || event.code;
5043
- let keyValue = event.charCode || event.keyCode || event.which;
5044
- let otherCodeList = [];
5045
- if (event.ctrlKey) {
5046
- otherCodeList.push("ctrl");
5047
- }
5048
- if (event.altKey) {
5049
- otherCodeList.push("alt");
5050
- }
5051
- if (event.metaKey) {
5052
- otherCodeList.push("meta");
5053
- }
5054
- if (event.shiftKey) {
5055
- otherCodeList.push("shift");
5056
- }
5057
- if (typeof callback === "function") {
5058
- callback(keyName, keyValue.toString(), otherCodeList, event);
5059
- }
5060
- };
5061
- target.addEventListener(eventName, keyEvent, options);
5062
- return {
5063
- removeListen() {
5064
- target.removeEventListener(eventName, keyEvent);
5065
- },
5066
- };
5067
- }
5068
5035
  /**
5069
5036
  * 自动锁对象,用于循环判断运行的函数,在循环外new后使用,注意,如果函数内部存在异步操作,需要使用await
5070
5037
  * @example