Misc docs: Evented aliases, deprecated LatLng stuff, Util.throttle. See #3098.

This commit is contained in:
Iván Sánchez Ortega 2015-06-10 15:17:27 +02:00 committed by Vladimir Agafonkin
parent fdddb648e8
commit 7192bde5f9

View File

@ -3623,36 +3623,6 @@ map.panTo(L.latLng(50, 30));</code></pre>
</tr> </tr>
</table> </table>
<h3>Constants</h3>
<table data-id='latlng'>
<tr>
<th class="width100">Constant</th>
<th class="width100">Type</th>
<th class="width100">Value</th>
<th>Description</th>
</tr>
<tr>
<td><code><b>DEG_TO_RAD</b></code></td>
<td><code>Number</code></td>
<td><code>Math.PI / <span class="number">180</span></code></td>
<td>A multiplier for converting degrees into radians.</td>
</tr>
<tr>
<td><code><b>RAD_TO_DEG</b></code></td>
<td><code>Number</code></td>
<td><code><span class="number">180</span> / Math.PI</code></td>
<td>A multiplier for converting radians into degrees.</td>
</tr>
<tr>
<td><code><b>MAX_MARGIN</b></code></td>
<td><code>Number</code></td>
<td><code><span class="number">1.0E-9</span></code></td>
<td>Max margin of error for the equality check.</td>
</tr>
</table>
<h2 id="latlngbounds">LatLngBounds</h2> <h2 id="latlngbounds">LatLngBounds</h2>
@ -4621,7 +4591,7 @@ map.off('click', onClick);</code></pre>
<th>Description</th> <th>Description</th>
</tr> </tr>
<tr> <tr>
<td><code><b>addEventListener</b>( <td><code><b>on</b>(
<nobr>&lt;String&gt; <i>type</i></nobr>, <nobr>&lt;String&gt; <i>type</i></nobr>,
<nobr>&lt;Function&gt; <i>fn</i></nobr>, <nobr>&lt;Function&gt; <i>fn</i></nobr>,
<nobr>&lt;Object&gt; <i>context?</i> )</nobr> <nobr>&lt;Object&gt; <i>context?</i> )</nobr>
@ -4631,7 +4601,7 @@ map.off('click', onClick);</code></pre>
<td>Adds a listener function (<code>fn</code>) to a particular event type of the object. You can optionally specify the context of the listener (object the <code><span class="keyword">this</span></code> keyword will point to). You can also pass several space-separated types (e.g. <code><span class="string">'click dblclick'</span></code>).</td> <td>Adds a listener function (<code>fn</code>) to a particular event type of the object. You can optionally specify the context of the listener (object the <code><span class="keyword">this</span></code> keyword will point to). You can also pass several space-separated types (e.g. <code><span class="string">'click dblclick'</span></code>).</td>
</tr> </tr>
<tr> <tr>
<td><code><b>addOneTimeEventListener</b>( <td><code><b>once</b>(
<nobr>&lt;String&gt; <i>type</i></nobr>, <nobr>&lt;String&gt; <i>type</i></nobr>,
<nobr>&lt;Function&gt; <i>fn</i></nobr>, <nobr>&lt;Function&gt; <i>fn</i></nobr>,
<nobr>&lt;Object&gt; <i>context?</i> )</nobr> <nobr>&lt;Object&gt; <i>context?</i> )</nobr>
@ -4641,7 +4611,7 @@ map.off('click', onClick);</code></pre>
<td>The same as above except the listener will only get fired once and then removed.</td> <td>The same as above except the listener will only get fired once and then removed.</td>
</tr> </tr>
<tr> <tr>
<td><code><b>addEventListener</b>( <td><code><b>on</b>(
<nobr>&lt;Object&gt; <i>eventMap</i></nobr>, <nobr>&lt;Object&gt; <i>eventMap</i></nobr>,
<nobr>&lt;Object&gt; <i>context?</i> )</nobr> <nobr>&lt;Object&gt; <i>context?</i> )</nobr>
</code></td> </code></td>
@ -4650,17 +4620,17 @@ map.off('click', onClick);</code></pre>
<td>Adds a set of type/listener pairs, e.g. <code>{click: onClick, mousemove: onMouseMove}</code></td> <td>Adds a set of type/listener pairs, e.g. <code>{click: onClick, mousemove: onMouseMove}</code></td>
</tr> </tr>
<tr> <tr>
<td><code><b>removeEventListener</b>( <td><code><b>off</b>(
<nobr>&lt;String&gt; <i>type</i></nobr>, <nobr>&lt;String&gt; <i>type</i></nobr>,
<nobr>&lt;Function&gt; <i>fn?</i></nobr>, <nobr>&lt;Function&gt; <i>fn?</i></nobr>,
<nobr>&lt;Object&gt; <i>context?</i> )</nobr> <nobr>&lt;Object&gt; <i>context?</i> )</nobr>
</code></td> </code></td>
<td><code><span class="keyword">this</span></code></td> <td><code><span class="keyword">this</span></code></td>
<td>Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to <code>addEventListener</code>, you must pass the same context to <code>removeEventListener</code> in order to remove the listener.</td> <td>Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to <code>on</code>, you must pass the same context to <code>off</code> in order to remove the listener.</td>
</tr> </tr>
<tr> <tr>
<td><code><b>removeEventListener</b>( <td><code><b>off</b>(
<nobr>&lt;Object&gt; <i>eventMap</i></nobr>, <nobr>&lt;Object&gt; <i>eventMap</i></nobr>,
<nobr>&lt;Object&gt; <i>context?</i> )</nobr> <nobr>&lt;Object&gt; <i>context?</i> )</nobr>
</code></td> </code></td>
@ -4669,21 +4639,21 @@ map.off('click', onClick);</code></pre>
<td>Removes a set of type/listener pairs.</code></td> <td>Removes a set of type/listener pairs.</code></td>
</tr> </tr>
<tr> <tr>
<td><code><b>removeEventListener</b>()</code></td> <td><code><b>off</b>()</code></td>
<td><code><span class="keyword">this</span></code></td> <td><code><span class="keyword">this</span></code></td>
<td>Removes all listeners. An alias to <code>clearAllEventListeners</code> when you use it without arguments.</td> <td>Removes all listeners to all events on the object.</td>
</tr> </tr>
<tr> <tr>
<td><code><b>hasEventListeners</b>( <td><code><b>listens</b>(
<nobr>&lt;String&gt; <i>type</i> )</nobr> <nobr>&lt;String&gt; <i>type</i> )</nobr>
</code></td> </code></td>
<td><code>Boolean</code></td> <td><code>Boolean</code></td>
<td>Returns <code><span class="literal">true</span></code> if a particular event type has some listeners attached to it.</td> <td>Returns <code><span class="literal">true</span></code> if a particular event type has any listeners attached to it.</td>
</tr> </tr>
<tr> <tr>
<td><code><b>fireEvent</b>( <td><code><b>fire</b>(
<nobr>&lt;String&gt; <i>type</i></nobr>, <nobr>&lt;String&gt; <i>type</i></nobr>,
<nobr>&lt;Object&gt; <i>data?</i> )</nobr> <nobr>&lt;Object&gt; <i>data?</i> )</nobr>
</code></td> </code></td>
@ -4691,31 +4661,36 @@ map.off('click', onClick);</code></pre>
<td><code><span class="keyword">this</span></code></td> <td><code><span class="keyword">this</span></code></td>
<td>Fires an event of the specified type. You can optionally provide an data object &mdash; the first argument of the listener function will contain its properties.</td> <td>Fires an event of the specified type. You can optionally provide an data object &mdash; the first argument of the listener function will contain its properties.</td>
</tr> </tr>
<tr>
<td><code><b>addEventListener</b>( &hellip; )</code></td>
<td><code><span class="keyword">this</span></code></td>
<td>Alias to <code>on</code>.</td>
</tr>
<tr>
<td><code><b>addOneTimeEventListener</b>( &hellip; )</code></td>
<td><code><span class="keyword">this</span></code></td>
<td>Alias to <code>once</code>.</td>
</tr>
<tr>
<td><code><b>removeEventListener</b>( &hellip; )</code></td>
<td><code><span class="keyword">this</span></code></td>
<td>Alias to <code>off</code>.</td>
</tr>
<tr> <tr>
<td><code><b>clearAllEventListeners</b>()</code></td> <td><code><b>clearAllEventListeners</b>()</code></td>
<td><code><span class="keyword">this</span></code></td> <td><code><span class="keyword">this</span></code></td>
<td>Removes all listeners to all events on the object.</code></td> <td>Alias to <code>off()</code>.</code></td>
</tr> </tr>
<tr> <tr>
<td><code><b>on</b>( &hellip; )</code></td> <td><code><b>hasEventListeners</b>( &hellip; )</code></td>
<td><code><span class="keyword">this</span></code></td> <td><code><span class="keyword">this</span></code></td>
<td>Alias to <code>addEventListener</code>.</td> <td>Alias to <code>listens</code>.</td>
</tr> </tr>
<tr> <tr>
<td><code><b>once</b>( &hellip; )</code></td> <td><code><b>fireEvent</b>( &hellip; )</code></td>
<td><code><span class="keyword">this</span></code></td> <td><code><span class="keyword">this</span></code></td>
<td>Alias to <code>addOneTimeEventListener</code>.</td> <td>Alias to <code>fire</code>.</td>
</tr>
<tr>
<td><code><b>off</b>( &hellip; )</code></td>
<td><code><span class="keyword">this</span></code></td>
<td>Alias to <code>removeEventListener</code>.</td>
</tr>
<tr>
<td><code><b>fire</b>( &hellip; )</code></td>
<td><code><span class="keyword">this</span></code></td>
<td>Alias to <code>fireEvent</code>.</td>
</tr> </tr>
</table> </table>
@ -4963,14 +4938,14 @@ Popups will also be automatically opened when the layer is clicked on and closed
<td>Cancels a previous request to <code>requestAnimFrame</code>.</td> <td>Cancels a previous request to <code>requestAnimFrame</code>.</td>
</tr> </tr>
<tr> <tr>
<td><code><b>limitExecByInterval</b>( <td><code><b>throttle</b>(
<nobr>&lt;Function&gt; <i>fn</i></nobr>, <nobr>&lt;Function&gt; <i>fn</i></nobr>,
<nobr>&lt;Number&gt; <i>time</i></nobr>, <nobr>&lt;Number&gt; <i>time</i></nobr>,
<nobr>&lt;Object&gt; <i>context?</i> )</nobr> <nobr>&lt;Object&gt; <i>context?</i> )</nobr>
</code></td> </code></td>
<td><code>Function</code></td> <td><code>Function</code></td>
<td>Returns a wrapper around the function <code>fn</code> that makes sure it's called not more often than a certain time interval <code>time</code>, but as fast as possible otherwise (for example, it is used for checking and requesting new tiles while dragging the map), optionally passing the scope (<code>context</code>) in which the function will be called.</td> <td>Returns a wrapper around the function <code>fn</code> that makes sure it's called not more often than a certain time interval <code>time</code> (in milliseconds), but as fast as possible otherwise (for example, it is used for checking and requesting new tiles while dragging the map), optionally passing the scope (<code>context</code>) in which the function will be called.</td>
</tr> </tr>
<tr> <tr>