Ticket #2518 (closed feature: duplicate)

Opened 3 years ago

Last modified 3 years ago

Base control: Automatically cancels the registration of listeners and destroys events.

Reported by: jorix Owned by: jorix
Priority: minor Milestone: 2.10 Release
Component: Control Version: SVN
Keywords: Cc:
State:

Description

This ticket is an improved management of events and listeners in controls. With these modifications in controls no needs to add properties to store instances of events for call “un” methods at controls destruction.

New features:

  • The new addListener method keeps the pairs of events and their eventListeners in a array. And calls the “on” events method for the listeners.
  • Allows setting the listener only active if the control is active. Using option “whenActive” to true.
  • New “removeListeners” method calls “un” method of events and destroys it if autoDestroy option is set to true. This occurs only when events have no listeners.
  • The method “removeListeners” is called in destroys controls.

It has opened two tickets to implement the methods activate and deactivate in Attribution and MousePosition controls using the new method benefits addListeners. See it in #2519 and #2520.

Attachments:

  • Patch of control.js with these new features.
  • Examples of using the new methods in:

The tests were passed successfully for all controls in: IE8, FF36 and CH4. (except for PanZoom.html test in FF36 that fails both with and without the patch, see #2510)

SVN Revision Number: 10094

Attachments

Control-2518.patch Download (8.5 KB) - added by jorix 3 years ago.
The patch
ControlLayerSwitcher-Example-2518.patch Download (1.0 KB) - added by jorix 3 years ago.
Example simple
ControlPanZoomBar-Example-2518.patch Download (4.9 KB) - added by jorix 3 years ago.
More complex example.
Control-2518(2).patch Download (9.9 KB) - added by jorix 3 years ago.
Also enables the use of multiple display classes.

Change History

Changed 3 years ago by jorix

The patch

Changed 3 years ago by jorix

Example simple

Changed 3 years ago by jorix

More complex example.

Changed 3 years ago by jorix

  • keywords review added
  • state set to Review

please review this ticket, and the others who have opened today and last week.

Changed 3 years ago by bartvde

  • milestone changed from 2.10 Release to 2.9 Release

Changed 3 years ago by bartvde

  • milestone changed from 2.9 Release to 2.10 Release

New feature so moving forward.

Changed 3 years ago by jorix

Also enables the use of multiple display classes.

Changed 3 years ago by jorix

Control-2518(2).patch also enables the use of multiple display classes.

please review

Changed 3 years ago by jorix

  • owner set to jorix

Changed 3 years ago by jorix

  • keywords review removed
  • state changed from Review to Needs More Work

I am working to split it into multiple tickets (see #2629 for addListener)

Changed 3 years ago by jorix

  • status changed from new to closed
  • state Needs More Work deleted
  • resolution set to duplicate

For now discard multiple display classes improvement. So, I close as duplicate.

To see the addListener improvement see #2629.

The #2519 and #2520 tickets are now dependent on #2629

Note: See TracTickets for help on using tickets.