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

Initial jsaction README #55521

Closed
wants to merge 1 commit into from
Closed

Conversation

rahatarmanahmed
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@angular-robot angular-robot bot added the area: docs Related to the documentation label Apr 24, 2024
@ngbot ngbot bot added this to the Backlog milestone Apr 24, 2024
Copy link

@jatraman jatraman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Add a link to EBNF for folks who aren't familiar.
  2. In the example, it'll help to explicitly call out what is the binding, event-type, event-handler. So users can immediately map it into the EBNF they just read.
  3. Actual plain HTML demo is a good idea!

@rahatarmanahmed
Copy link
Contributor Author

I didn't end up writing a demo server since I'd need to set up some compilation for the jsaction TS files to use them.

@rahatarmanahmed rahatarmanahmed marked this pull request as ready for review April 26, 2024 15:27
@pullapprove pullapprove bot added the requires: TGP This PR requires a passing TGP before merging is allowed label Apr 26, 2024
@thePunderWoman thePunderWoman added the target: rc This PR is targeted for the next release-candidate label Apr 26, 2024
Copy link
Contributor

@tbondwilkinson tbondwilkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also want to document MOUSE_SPECIAL and a11y click, potentially

registration of event listeners from the JavaScript code for the listeners
themselves. This enables capturing user interactions before the application is
bootstrapped or hydrated as well as very fine grained lazy loading of event
handling code. It is primarily intended to use as part of a larger framework,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"It is typically used as a sub-component of a larger framework, rather than as a stand-alone library."


## How it works

The traditional way of adding an event handler is to obtain a reference to the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The traditional way of adding an event handler is to obtain a reference to the
The traditional way of adding an event listener is to obtain a reference to the

## How it works

The traditional way of adding an event handler is to obtain a reference to the
node and add the event handler to it via `.addEventListener` (or `.onclick`-like
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node and add the event handler to it via `.addEventListener` (or `.onclick`-like
node and call `.addEventListener` (or `.onclick`-like

<!--
There's a window of time between when the button is rendered and the
script below reaches the client, either because there's a lot of content
streamed in-between or network lag.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
streamed in-between or network lag.
streamed in-between, network lag, or the script is asynchronously via a follow-up network request rather than as part of the main document content.

```

A small inline script is added before any application content which registers
global event handlers for all event types that the application listens to. Any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
global event handlers for all event types that the application listens to. Any
global event handlers for event types that could be delegated. Any

### 4. Register your application with JSAction

Finally, once your application is bootstrapped and ready to handle events,
you'll need to create a Dispatcher and register it with the dormant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"dormant" feels like the wrong adjective, but I think we don't need a qualifier just say "with the EventContract

packages/core/primitives/event-dispatch/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahatarmanahmed looks great 👍

packages/core/primitives/event-dispatch/README.md Outdated Show resolved Hide resolved
@rahatarmanahmed rahatarmanahmed added the action: merge The PR is ready for merge by the caretaker label Apr 30, 2024
@AndrewKushnir AndrewKushnir removed the request for review from jatraman April 30, 2024 22:01
@thePunderWoman
Copy link
Contributor

TESTED=docs only. No TGP needed.

@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit cda8bfa.

AndrewKushnir pushed a commit that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: docs Related to the documentation requires: TGP This PR requires a passing TGP before merging is allowed target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants