wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Add support for `signal` field to `AddEventListenerOptions`

Open themaxdavitt opened this issue 4 years ago • 1 comments

Motivation

The options argument to EventTarget.addEventListener() can take an AbortSignal through it's signal key, but our AddEventListenerOptions type doesn't support this.

Proposed Solution

I believe all we need to do is copy one of the existing field manipulation functions and change it's parameter type (to AbortSignal) and field name (to signal).

Alternatives

The alternative is to do the same sort of manual field-setting code that's already handled for us in the function I linked above. This makes using functions like EventTarget::add_event_listener_with_callback_and_add_event_listener_options annoying for instance.

themaxdavitt avatar Oct 25 '21 17:10 themaxdavitt

This seems to be in the documentation but is not available when I try to use it.

I've ensured the required features are enabled.

bicarlsen avatar Aug 13 '24 09:08 bicarlsen

This was fixed in https://github.com/rustwasm/wasm-bindgen/pull/4026.

This seems to be in the documentation but is not available when I try to use it.

I've ensured the required features are enabled.

You might need to update to the newest version, #4026 was added in v0.3.70. Let me know if you still encounter problems.

daxpedda avatar Oct 07 '24 10:10 daxpedda