Skip to content

Commit

Permalink
minor #2039 [Map] Change "BeforeConnect" for "BeforeCreate" in docume…
Browse files Browse the repository at this point in the history
…ntation (Kocal)

This PR was merged into the 2.x branch.

Discussion
----------

[Map] Change "BeforeConnect" for "BeforeCreate" in documentation

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - For new features, provide some code snippets to help understand usage.
 - Features and deprecations must be submitted against branch main.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Technically the code is not wrong, but when listening for events `ux:map:marker:before-create` or `ux:map:info-window:before-create`, you can expect the method to be named `*BeforeCreate` and not `*BeforeConnect`.

Commits
-------

eceb244 [Map] Change "BeforeConnect" for "BeforeCreate" in documentation
  • Loading branch information
javiereguiluz committed Aug 9, 2024
2 parents 6918605 + eceb244 commit 6b8b305
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Map/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,19 @@ Symfony UX Map allows you to extend its default behavior using a custom Stimulus
connect() {
this.element.addEventListener('ux:map:pre-connect', this._onPreConnect);
this.element.addEventListener('ux:map:connect', this._onConnect);
this.element.addEventListener('ux:map:marker:before-create', this._onMarkerBeforeConnect);
this.element.addEventListener('ux:map:marker:before-create', this._onMarkerBeforeCreate);
this.element.addEventListener('ux:map:marker:after-create', this._onMarkerAfterCreate);
this.element.addEventListener('ux:map:info-window:before-create', this._onInfoWindowBeforeConnect);
this.element.addEventListener('ux:map:info-window:before-create', this._onInfoWindowBeforeCreate);
this.element.addEventListener('ux:map:info-window:after-create', this._onInfoWindowAfterCreate);
}
disconnect() {
// You should always remove listeners when the controller is disconnected to avoid side effects
this.element.removeEventListener('ux:map:pre-connect', this._onPreConnect);
this.element.removeEventListener('ux:map:connect', this._onConnect);
this.element.removeEventListener('ux:map:marker:before-create', this._onMarkerBeforeConnect);
this.element.removeEventListener('ux:map:marker:before-create', this._onMarkerBeforeCreate);
this.element.removeEventListener('ux:map:marker:after-create', this._onMarkerAfterCreate);
this.element.removeEventListener('ux:map:info-window:before-create', this._onInfoWindowBeforeConnect);
this.element.removeEventListener('ux:map:info-window:before-create', this._onInfoWindowBeforeCreate);
this.element.removeEventListener('ux:map:info-window:after-create', this._onInfoWindowAfterCreate);
}
Expand All @@ -159,7 +159,7 @@ Symfony UX Map allows you to extend its default behavior using a custom Stimulus
console.log(event.detail.infoWindows);
}
_onMarkerBeforeConnect(event) {
_onMarkerBeforeCreate(event) {
// The marker is not created yet
// You can use this event to configure the marker before it is created
console.log(event.detail.definition);
Expand All @@ -171,7 +171,7 @@ Symfony UX Map allows you to extend its default behavior using a custom Stimulus
console.log(event.detail.marker);
}
_onInfoWindowBeforeConnect(event) {
_onInfoWindowBeforeCreate(event) {
// The infoWindow is not created yet
// You can use this event to configure the infoWindow before it is created
console.log(event.detail.definition);
Expand Down

0 comments on commit 6b8b305

Please sign in to comment.