adopted-ember-addons / adopted-ember-addons/ember-keyboard

Deprecation error with simple keyboard shortcut implementation

未关闭
#194 12 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
177
派生
59
PR 合并指标
30 天内没有已合并 PR

描述

I implemtented two simple keyboard shortcuts in my app:

```
{{on-key 'ctrl+m' this.toggleVisibility}}
{{on-key 'ctrl+b' this.toggleVisibility}}
```

These toggle the visibility of something:

```
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';

export default class styleguideComponent extends Component {
@tracked visibility = true;
@service router;

@action
toggleVisibility() {
this.visibility = !this.visibility
}
}

```

However, I get a long depreciation [stack trace](https://gist.github.com/Wolfr/cdaa8acc78ab9ff5a1c908b1e6c761a6) . I think I used the latest syntax as documented [here](http://adopted-ember-addons.github.io/ember-keyboard/usage).

If I remove the 2nd shortcut, I don't get the stack trace. However, it is recommended in the docs to do it this way for multiple shortcuts.

Would anyone have an idea why I am getting this stack trace? I loved the simplicity of this package btw.

贡献指南

打开贡献指南

调研方向

Start by reproducing the two `on-key` shortcuts from the issue and compare them with the multiple-shortcut usage documented at the linked Ember Keyboard guide. Inspect the linked deprecation stack trace to identify the failing path. Done means both shortcuts toggle visibility without producing the deprecation trace.

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。