Commit Graph

39 Commits

Author SHA1 Message Date
Per Liedman
c18ac11efb Include L.Mixin.Events again; add deprecation notice (#5365)
Close #5358
2017-03-07 09:53:24 +01:00
Per Liedman
017d29c4eb Just store array of listeners, count is no longer needed. (#4842)
* Just store array of listeners, count is no longer needed.

* Remove unused code
2016-08-25 17:23:58 +02:00
Per Liedman
cee8edeaf2 Fix listener removal even if an event is firing
Close #4840.
2016-08-25 15:20:51 +02:00
Per Liedman
59c6bb201c Use spies as listeners 2016-08-24 09:52:29 +02:00
Per Liedman
0c6dc2ce1e Make event firing reentrant
Close #4833
2016-08-24 09:26:53 +02:00
Yohan Boniface
8047b0b7a9 Make sure we call event listeners in the order they are registered (fix #4743) (#4769) 2016-08-02 17:53:06 +03:00
Per Liedman
0bcfbdb537 Cleanup, tests and minor bug fixes for event system 2016-07-08 15:01:38 +02:00
Fabian Zeindl
0210071dad refactoring of events, it should be about 4 times faster now 2016-07-08 14:47:02 +02:00
Iván Sánchez Ortega
8cb745ce0a L.Evented.listens() returns false on removed event handlers, #4474 (#4476)
* Fix L.Evented.listens() on removed event handlers, #4474

* Fix bad unit tests for marker events

* Only check for listerners.length if listerners is actually defined
2016-07-01 11:14:22 +02:00
Per Liedman
fbc6265fb7 Fix when all listeners are removed during dispatch (#4555)
Close #4478.
2016-05-12 10:22:36 +02:00
Vladimir Agafonkin
8c8d0ac7ee fix whitespace in comments 2015-09-25 15:37:07 +03:00
Vladimir Agafonkin
cfdbd10431 enforce indentation in specs 2015-09-25 13:55:37 +03:00
Asko Kauppi
f61a681c56 fix 'jake' 2015-03-01 22:51:04 +02:00
Vladimir Agafonkin
d145b1fdba fix a bunch of eslint warnings in the spec suite 2015-01-28 19:32:27 +02:00
Vladimir Agafonkin
1dfec0a021 shortcut hasEventListeners as listens 2013-12-19 17:09:32 -05:00
Vladimir Agafonkin
6d1142a978 only propagate events if given true to fire, #2311 2013-12-18 23:23:22 -05:00
Vladimir Agafonkin
ce4a031d40 faster on/off, add private non-sugary versions 2013-12-18 23:07:39 -05:00
Vladimir Agafonkin
21cfd7f3d9 replace Events mixin with Evented inheritance 2013-12-17 14:07:21 -05:00
Vladimir Agafonkin
91c039b7aa jshinting and major clean up of specs code, ref #2151 2013-11-07 23:54:33 +02:00
danzel
fa35aba1e9 Improve this test and fix removeEventListener. 2013-11-05 10:29:52 +13:00
danzel
579c044c00 Fix a potential event bug due to bad cleanup. 2013-11-05 10:21:32 +13:00
danzel
9fce697982 Work around iOS7 memory trouble by not applying the contextId performance optimization when context==this. The optimization does nothing in this case anyway. Fixes #2122 2013-11-04 09:47:55 +13:00
Vladimir Agafonkin
0849d06c1b fix whitespace in event spec, #1661 2013-05-08 12:58:50 +03:00
R. Merkert
bbb7acb3f4 Make sure events don't fire after listener is removed.
This patch fixes a problem with a dangling  event listener, which is
called even after it has been removed. This situation can occur when a
listener is removed during an even dispatch.

To fix this problem, the old action is replaced with a NOOP, so that
when the listener is being fired, it is not the old listener but the
NOOP.
2013-05-07 20:16:25 -04:00
Daan Mortier
c6620859e4 Updated patch for issue #1631 based on feedback 2013-04-29 13:03:05 +02:00
Daan Mortier
52498f1ef9 Issue #1631: Fixed a bug on removeEventListener
Bugfix for issue #1631 where removeEventListener would throw when no event listeners are registered on the object.
2013-04-29 11:53:16 +02:00
Vladimir Agafonkin
5647f37ae6 cleanup and merge #1596, adds Events#once 2013-04-19 17:23:45 +03:00
iirvine
84ad7db070 clearEventListeners -> clearAllListeners 2013-04-15 14:09:32 -07:00
iirvine
2d5bf783fe initial commit of #clearEventListeners 2013-04-15 14:09:32 -07:00
John Firebaugh
81f21125d4 Update specs for mocha 2013-04-03 15:22:45 -07:00
Tom MacWright
a2f7d7e834 Use mocha 2013-04-03 14:50:09 -07:00
danzel
9d4d894450 Add another events test and fix from @iirvine 2013-03-15 13:53:03 +13:00
danzel
44cbed0b5e Replace the FeatureGroup test with a better one in events, this one currently fails 2013-03-13 10:08:04 +13:00
John Firebaugh
01332ebead Omit "should" in spec descriptions
The rationale is this: the spec string describes the expected
behavior unconditionally. The code examples, on the other hand,
set up an expectation that is tested with the call to the expect
method. The code examples can violate the expectation, but the
spec string does not. The value of the spec string is as clearly
as possible describing the behavior. Including “should” in that
description adds no value. (From http://rubyspec.org/style_guide/)
2013-02-19 12:41:48 -08:00
Tom MacWright
0a2000166a Fix semicolons, breaking, whitespace, duplicate var statements. 2013-02-19 11:18:15 -05:00
Vladimir Agafonkin
ed8dc9f4cd improve core specs #1347 2013-02-04 18:31:14 +02:00
Aaron King
95ed9cdda2 Allow L.Mixin.Events.addEventListener() to accept a map in which the string keys represent one or more space-separated event types and the values represent a handler function to be called for the event(s).
Allow L.Mixin.Events.removeEventListener() to accept one or more space-separated event types. Omitting the fn parameter will remove all event handlers for the supplied event type(s).

Also allow L.Mixin.Events.removeEventListener() to accept a map where the string keys represent one or more space-separated event types and the values represent handler functions previously attached for the event(s).

Add unit tests for the above changes.
2012-06-29 16:14:41 -07:00
mourner
7cef8d3851 Events fire shortcut 2010-09-10 16:54:20 +03:00
mourner
db5809b473 Events fixes, Events spec 2010-09-03 19:16:29 +03:00