René's URL Explorer Experiment


Title: Support cold event streams in templates · Issue #13248 · angular/angular · GitHub

Open Graph Title: Support cold event streams in templates · Issue #13248 · angular/angular

X Title: Support cold event streams in templates · Issue #13248 · angular/angular

Description: Requirements [R1] Observables must be cold (ie if there is no subscription then there should be no listeners.) USE CASE: drag and drop. No need to listen on mousemove if drag has not been initiated. [R2] It must be possible to execute an...

Open Graph Description: Requirements [R1] Observables must be cold (ie if there is no subscription then there should be no listeners.) USE CASE: drag and drop. No need to listen on mousemove if drag has not been initiated...

X Description: Requirements [R1] Observables must be cold (ie if there is no subscription then there should be no listeners.) USE CASE: drag and drop. No need to listen on mousemove if drag has not been initiated...

Opengraph URL: https://github.com/angular/angular/issues/13248

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support cold event streams in templates","articleBody":"# Requirements\r\n* [R1] Observables must be cold (ie if there is no subscription then there should be no listeners.)\r\nUSE CASE: drag and drop. No need to listen on mousemove if drag has not been initiated.\r\n* [R2] It must be possible to execute an expression which computes the action which will be next-ed into the observable.\r\n  - USE CASE: ngFor shows a list of todos with a remove button. Clicking the remove should notify the stream not with the DOM event, but with the item to be removed.\r\n* [R3] It must be possible to set up observable recipes to run inside/outside of angular zone.\r\n  - USE CASE: \r\n    - drag and drop. Don't run CD on mousemove. \r\n    - Throttle; debounce; etc..: Only run CD on subscription which pass throttle, debounce; etc.\r\n* [R4] It would be strongly preferable if there was something in the template which would indicate that an observable is listening at a given location. \r\n  - USE CASE: it should be easy for the developer/tooling to see where in the source code the event will be processed.\r\n\r\n\r\n# Design\r\n\r\n* Component will annotate fields which will represent Observable Streams which will be created by the Template's ViewFactory. [R4] (This will also determine the parameterization for the Observables. (ie `Observable\u003cMyType>)`)\r\n  - The Framework will set those fields right after constructing the object. We need a new hook (`ngOnCreate`) which would be called right after setting the fields but before running first change detection (`ngOnChanges`, `ngOnInit`).\r\n* Create new syntax which will describe [R4]:\r\n  - Which events should the template listen on [R4].\r\n  - How should the action be computed [R2].\r\n  - Which stream should receive the action\r\n*Split Angular Zone into `NgErrorZone` for error handling and `NgChangeDetectionZone` for CD. [R3]\r\n  - Provide convenience method running code in `NgErrorZone` and `NgChangeDetectionZone`. [R3]\r\n\r\n```ts\r\n@Component({\r\n  template: `\r\n    \u003cul>\r\n      \u003cli *ngFor=\"let user of users; let i = index\">\r\n        {{user.name}}\r\n        \u003cbutton (*click|remove)=\"{item: user, index: i}\">X\u003c/button>\r\n      \u003cli>\r\n    \u003cul>\r\n`\r\n})\r\nclass MyComponent implements OnCreate{\r\n  users: User[] = ...;\r\n\r\n\r\n  // Specify that this will have property injection.\r\n  @Inject()\r\n  remove: Observable\u003c{item: User, index: number}>;\r\n\r\n\r\n  actions: Observable\u003cAction>;\r\n\r\n\r\n  ngOnCreate() {\r\n    // An example of building up a recipe.\r\n    // Notice that we are making sure that Rx operators have no CD.\r\n    this.actions = noChangeDetection(() => remove.map(() => ...));\r\n  }\r\n}\r\n```\r\n\r\n* ViewFactory creates an instance of Observable which then is property injected into component\r\n  - Observable names and types (Type parameters) are declared in the component\r\n  - `@Inject()` identifies that the observable has to be generated in the `ViewContainer`.\r\n  - Need a `ngOnCreate()` hook to create recipes.\r\n* Need `noChangeDetection()` method for  going in and out of CD. Separate Design Doc TBD.\r\n* `(*click|remove)=\"{item: user, index: i}\"` Placeholder syntax, see discussion later. This is used to generate cold event registration for DOM events. The expression is used to compute the value which will be next ed into the observable.\r\n  - Notice that even though there are zero or more instance of places where we listen into DOM events, there is always only one observable instance given that name.\r\n\r\n# Syntax Discussion\r\n\r\nNOTE: The above syntax is used only as a placeholder\r\n\r\nThe Syntax Requirements:\r\n* The syntax needs to encode three items:\r\n  - `event`: The DOM event\r\n  - `stream`: The destination stream\r\n  - `actionExp`: The action object\r\n* Given that we need to encode three things and that `key=\"value\"` only takes two by default we have to figure out how to encode three things into two. The choices are:\r\n  - `event+stream=\"actionExp\"`: [favorite]\r\n    - This format combines event and stream on the LHS. \r\n    - Both event and stream are just symbols (ie foo) not complex expressions (ie `{name: foo + 2}`) and so they can be on the LHS. \r\n    - Event is already on LHS in `(event)=\"stmt\"` so it should stay there.\r\n    - There is already a precedence for compound LHS in `style.width.px=\"123\"`.\r\n    - Example: `(*click|remove)=\"actionExp\"`. \r\n      - The `*` is preferred (not necessary) as it hints that it is cold (not always listening)\r\n      - The `(...)` should be retained to be consistent with normal event listeners\r\n  - `event=\"stream+actionExp\"`: [probably not]\r\n    - Micro Syntax has precedence for combining multiple formats on the RHS (but it requires special symbol on the LHS to activate it.) \r\n    - Microsyntax is shorthand for an expanded canonical form. Here there would be no canonical form. \r\n    - Example: `(*click)=\"actionExp into remove\"`\r\n      - The `*` is required as it hints that it is cold (not always listening) and that it is different from normal listener.\r\n      - The `(...)` should be retained to be consistent with normal event listeners\r\n* `stream-action=\"actionExp\" stream-event=\"event\"`: [strongly against]\r\n  - Require two key-value pairs.\r\n  - This format is just very wordy and cumbersome. \r\n  - Puts event on the RHS whereas it is on LHS in `(event)=\"stmt\"`.\r\n\r\n","author":{"url":"https://github.com/mhevery","@type":"Person","name":"mhevery"},"datePublished":"2016-12-05T19:51:34Z","url":"https://github.com/angular/angular/issues/13248"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b980ae53-add5-4db9-7ea6-7d7ba1f0f618
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC310:19AA62:1B09D11:225A7F5:6B014FDB
html-safe-nonce8d26559ccec7fb66bdf4749e2e8b8cf368a641f60d63eb8e01b94432d2c93735
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzEwOjE5QUE2MjoxQjA5RDExOjIyNUE3RjU6NkIwMTRGREIiLCJ2aXNpdG9yX2lkIjoiNzUwMjE3OTA2MDMwNzU0NjA3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac015f189910f1559e742c191339053ad83d2b35f75d3818872f23929ba25347e8
hovercard-subject-tagissue:193593423
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/13248/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e797d1ab1b54674062040ca21f153ee14f2632fd132cffb07b3111953225e558/angular/angular/issues/13248
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e797d1ab1b54674062040ca21f153ee14f2632fd132cffb07b3111953225e558/angular/angular/issues/13248
og:image:altRequirements [R1] Observables must be cold (ie if there is no subscription then there should be no listeners.) USE CASE: drag and drop. No need to listen on mousemove if drag has not been initiated...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemhevery
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/13248#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F13248
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F13248
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/13248
Reloadhttps://github.com/angular/angular/issues/13248
Reloadhttps://github.com/angular/angular/issues/13248
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues836 (836)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/13248
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/13248
Support cold event streams in templateshttps://github.com/angular/angular/issues/13248#top
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: event listenershttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20event%20listeners%22
cross-cutting: observableshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20observables%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Dec 5, 2016https://github.com/angular/angular/issues/13248#issue-193593423
Nexthttps://github.com/angular/angular/issues/13248?timeline_page=1
https://github.com/frederikschubert
frederikschuberthttps://github.com/frederikschubert
on Dec 5, 2016https://github.com/angular/angular/issues/13248#issuecomment-264991924
https://github.com/lacolaco
lacolacohttps://github.com/lacolaco
on Dec 6, 2016https://github.com/angular/angular/issues/13248#issuecomment-265051778
https://github.com/flga
flgahttps://github.com/flga
on Dec 6, 2016https://github.com/angular/angular/issues/13248#issuecomment-265068335
https://github.com/vicb
vicbhttps://github.com/vicb
on Dec 6, 2016https://github.com/angular/angular/issues/13248#issuecomment-265074877
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
on Dec 6, 2016https://github.com/angular/angular/issues/13248#event-883569308
https://github.com/vicb
vicbhttps://github.com/vicb
on Dec 6, 2016https://github.com/angular/angular/issues/13248#issuecomment-265220688
@mheveryhttps://github.com/mhevery
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Dec 7, 2016https://github.com/angular/angular/issues/13248#issuecomment-265600796
mheveryhttps://github.com/mhevery
on Dec 13, 2016https://github.com/angular/angular/issues/13248#event-892725796
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Dec 16, 2016https://github.com/angular/angular/issues/13248#issuecomment-267485492
@vicbhttps://github.com/vicb
@IgorMinarhttps://github.com/IgorMinar
@Bleshhttps://github.com/Blesh
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Dec 16, 2016https://github.com/angular/angular/issues/13248#issuecomment-267702206
https://github.com/benlesh
benleshhttps://github.com/benlesh
on Dec 17, 2016https://github.com/angular/angular/issues/13248#issuecomment-267729241
https://github.com/vicb
vicbhttps://github.com/vicb
on Dec 17, 2016https://github.com/angular/angular/issues/13248#issuecomment-267737207
@Bleshhttps://github.com/Blesh
https://github.com/wardbell
wardbellhttps://github.com/wardbell
on Dec 17, 2016https://github.com/angular/angular/issues/13248#issuecomment-267737950
@Bleshhttps://github.com/Blesh
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Dec 17, 2016https://github.com/angular/angular/issues/13248#issuecomment-267780632
https://github.com/fxck
fxckhttps://github.com/fxck
on Dec 19, 2016https://github.com/angular/angular/issues/13248#issuecomment-267964692
@robwormaldhttps://github.com/robwormald
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Jul 25, 2018https://github.com/angular/angular/issues/13248#issuecomment-407629490
https://github.com/chaosmonster
chaosmonsterhttps://github.com/chaosmonster
on Feb 13, 2019https://github.com/angular/angular/issues/13248#issuecomment-463330267
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Feb 13, 2019https://github.com/angular/angular/issues/13248#issuecomment-463381270
https://blog.angular.io/a-plan-for-version-8-0-and-ivy-b3318dfc19f7https://blog.angular.io/a-plan-for-version-8-0-and-ivy-b3318dfc19f7
https://github.com/stupidawesome
stupidawesomehttps://github.com/stupidawesome
on May 26, 2019https://github.com/angular/angular/issues/13248#issuecomment-495964973
NgObservablehttps://github.com/zodiac-team/zodiac-ui/tree/master/libs/ng-observable
And much morehttps://dev.to/michaelmuscat/create-observable-angular-components-with-ngobservable-2424
grab it on NPMhttps://www.npmjs.com/package/@zodiac-ui/ng-observable
https://github.com/d3lm
d3lmhttps://github.com/d3lm
on Jul 8, 2019https://github.com/angular/angular/issues/13248#issuecomment-509314271
@mheveryhttps://github.com/mhevery
https://github.com/typebytes/ngx-template-streamshttps://github.com/typebytes/ngx-template-streams
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
core: event listenershttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20event%20listeners%22
on Mar 10, 2020https://github.com/angular/angular/issues/13248#event-3115282673
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
cross-cutting: observableshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20observables%22
on May 2, 2020https://github.com/angular/angular/issues/13248#event-3295068590
https://github.com/jinder
jinderhttps://github.com/jinder
on Aug 28, 2020https://github.com/angular/angular/issues/13248#issuecomment-682864497
https://github.com/mhevery
mheveryhttps://github.com/mhevery
on Sep 1, 2020https://github.com/angular/angular/issues/13248#issuecomment-685110358
https://github.com/hiepxanh
hiepxanhhttps://github.com/hiepxanh
on Jan 3, 2021https://github.com/angular/angular/issues/13248#issuecomment-753614831
angular-robothttps://github.com/apps/angular-robot
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
on Aug 13, 2021https://github.com/angular/angular/issues/13248#event-5155980876
https://github.com/petebacondarwin
petebacondarwinhttps://github.com/petebacondarwin
on Oct 15, 2021https://github.com/angular/angular/issues/13248#issuecomment-944443069
#43485https://github.com/angular/angular/issues/43485
https://github.com/digeomel
digeomelhttps://github.com/digeomel
on Feb 15, 2023https://github.com/angular/angular/issues/13248#issuecomment-1431683406
#1773https://github.com/angular/angular/issues/1773
https://github.com/VladimirCreator
VladimirCreatorhttps://github.com/VladimirCreator
on Feb 1, 2025https://github.com/angular/angular/issues/13248#issuecomment-2629146265
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/13248
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/13248
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: event listenershttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20event%20listeners%22
cross-cutting: observableshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20observables%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.