coderwhy / coderwhy/hy-event-store

事件总线event三个方法分别用于什么场景?

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
411
Forks
45
Avg merge
1m
Merged PRs (30d)
6

Description

事件总线event三个方法:on,once,off分别用于什么场景?
我在微信小程序中使用,想在切换组件是发送事件,切换可以不生效。
但是:
使用on时,在切换组件会触发多次,会有错误数据;
使用once时,在切换不生效的情况下,无法发送第二次;
使用off时,报错 Cannot read property 'length' of undefined;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the on, once, and off API entry points, then reproduce the component-switching case in a WeChat mini-program. Done means the expected use of each method and the causes of repeated callbacks, the failed second send, and the off error are documented or fixed, with a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.