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

add documentation for 'change:extent' event #13

Merged
merged 2 commits into from
Jan 29, 2024
Merged

Conversation

jpalys
Copy link
Contributor

@jpalys jpalys commented Jan 27, 2024

No description provided.

@jpalys jpalys requested a review from jkissel January 27, 2024 14:17
@jpalys jpalys self-assigned this Jan 27, 2024
src/cadenza.js Outdated
@@ -204,6 +204,8 @@ export class CadenzaClient {
* view, each row includes the geometry of the selected object as the last value.
* <p>
* See also: [JSON Representation of Cadenza Object Data](../index.html#md:json-representation-of-cadenza-object-data)
* @fires `change:extent` - When the map extent is changed a POST message 'change:extent' is fired.
* The event details contain the new {@link Extent} of the map (transformed to EPSG:4326).
Copy link
Member

Choose a reason for hiding this comment

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

On Friday, I improved the way how events are documented: 6020ae8

Goals:

  • Remove the duplication of the documentation if the event is fired from multiple methods (like in your case).
  • Document the type of the event detail.

Proposal for your event:

/** @typedef {CadenzaEvent<'change:extent', {extent: Extent}>} CadenzaChangeExtentEvent - When the user moved the map. The extent is transformed according to the `useMapSrs` option. */

(Sry, I should've informed you about the change. I hope I didn't cause too much trouble.)

@@ -205,6 +205,19 @@ const unsubscribe = cadenzaClient.on('editGeometry:ok', (event) => ...);
unsubscribe();
```

### Subscribe to map extent change

Subscribe to `extent:change` event to be notified about map extent changes. The event details contain the new map extent (transformed to EPSG:4326):
Copy link
Member

Choose a reason for hiding this comment

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

It's change:extent. But if I look at the example - maybe it's not really necessary, because the event is documented in the api docs and we already have an example for subscribing to an event in TS. What do you think?

If you keep the example (and resolved the above comment), you should use the CadenzaChangeExtentEvent type.

@jpalys jpalys merged commit 162c6e5 into main Jan 29, 2024
1 check failed
@jpalys jpalys deleted the change_extent_docs branch January 29, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants