Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fromEvent): support HTMLElement #2048

Merged
merged 3 commits into from Oct 5, 2022
Merged

Conversation

rorry121
Copy link
Contributor

@rorry121 rorry121 commented Aug 5, 2022

Description

Hi, thanks to @vueuse and @vueuse/rxjs,I can use rxjs in vue easily.
The fromEvent function support Ref<HTMLElement>, and code:

import { fromEvent } from '@vueuse/rxjs'
import { fromEvent as fromEventRx } from "rxjs";
const mousedown$ = fromEvent(resizeAnchorRef!, 'mousedown');
const mouseup$ = fromEventRx(document.body, 'mouseup');
const mousemove$ = fromEventRx(document.body, 'mousemove');

Expect fromEvent can also support HTMLElement, so I can use like this:

import { fromEvent } from '@vueuse/rxjs'
const mousedown$ = fromEvent(resizeAnchorRef!, 'mousedown');
const mouseup$ = fromEvent(document.body, 'mouseup');
const mousemove$ = fromEvent(document.body, 'mousemove');

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

packages/rxjs/from/index.ts Outdated Show resolved Hide resolved
@stale
Copy link

stale bot commented Oct 5, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 5, 2022
@antfu antfu merged commit 554a3cf into vueuse:main Oct 5, 2022
@stale stale bot removed the stale label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants