mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
Update when.md (#1554)
* Update when.md: include info on importing when to get access --------- Co-authored-by: Jeff Glass <glass.jeffrey@gmail.com>
This commit is contained in:
@@ -6,6 +6,9 @@ The `@when` decorator attaches the decorated function or Callable as an event ha
|
||||
|
||||
If the decorated function takes a single (non-self) argument, it will be passed the [Event object](https://developer.mozilla.org/en-US/docs/Web/API/Event) corresponding to the triggered event. If the function takes no (non-self) argument, it will be called with no arguments.
|
||||
|
||||
You will need to import `when` to get access to this feature:
|
||||
`from pyscript import when`
|
||||
|
||||
## Parameters
|
||||
|
||||
`event_type` - A string representing the event type to match against. This can be any of the [https://developer.mozilla.org/en-US/docs/Web/Events#event_listing](https://developer.mozilla.org/en-US/docs/Web/Events) that HTML elements may emit, as appropriate to their element type.
|
||||
|
||||
Reference in New Issue
Block a user