mirror of
https://github.com/pebble-dev/clay.git
synced 2026-09-02 23:27:38 -04:00
drop ClayEvents.one since it is a pain to work with and add tests for ClayEvents
This commit is contained in:
+69
-2
@@ -1,7 +1,8 @@
|
||||
// minified.js config start -- use this comment to re-create a configuration in the Builder
|
||||
// - Only sections add, always, amdsupport, copyobj, dollardollar,
|
||||
// - each, eachobj, error, extend, format, formathtml, get, ht, html, isobject,
|
||||
// - off, on, ready, request, select, set, template, trigger, underscore, wait.
|
||||
// - each, eachobj, error, extend, find, format, formathtml, get, ht, html,
|
||||
// - isobject, off, on, ready, request, select, set, template, trigger, underscore,
|
||||
// - wait.
|
||||
|
||||
|
||||
// WARNING! This file is autogenerated from minified-master.js and others.
|
||||
@@ -1549,6 +1550,69 @@ define('minified', function() {
|
||||
*/
|
||||
'each': listBind(each),
|
||||
|
||||
/*$
|
||||
* @id find
|
||||
* @group LIST
|
||||
* @requires
|
||||
* @configurable default
|
||||
* @name .find()
|
||||
* @altname _.find()
|
||||
* @syntax list.find(findFunc)
|
||||
* @syntax list.find(element)
|
||||
* @syntax list.find(findFunc, startIndex)
|
||||
* @syntax list.find(element, startIndex)
|
||||
* @syntax _.find(list, findFunc)
|
||||
* @syntax _.find(list, element)
|
||||
* @syntax _.find(list, findFunc, startIndex)
|
||||
* @syntax _.find(list, element, startIndex)
|
||||
* @module WEB, UTIL
|
||||
* Finds a specific value in the list. There are two ways of calling <var>find()</var>:
|
||||
* <ol>
|
||||
* <li>With a value as argument. Then <var>find()</var> will search for the first occurrence of an identical value in the list,
|
||||
* using the '===' operator for comparisons, and return the index. If it is not found,
|
||||
* <var>find()</var> returns <var>undefined</var>.</li>
|
||||
* <li>With a callback function. <var>find()</var> will then call the given function for each list element until the function
|
||||
* returns a value that is not <var>null</var> or <var>undefined</var>. This value will be returned.</li>
|
||||
* </ol>
|
||||
*
|
||||
* <var>find()</var> can also be used as an alternative to ##each() if you need to abort the loop.
|
||||
*
|
||||
* @example Finds the first negative number in the list:
|
||||
* <pre>
|
||||
* var i = _(1, 2, -4, 5, 2, -1).find(function(value, index) { if (value < 0) return index; }); // returns 2
|
||||
* </pre>
|
||||
|
||||
* @example Finds the index of the first 5 in the array:
|
||||
* <pre>
|
||||
* var i = _.find([3, 6, 7, 6, 5, 4, 5], 5); // returns 4 (index of first 5)
|
||||
* </pre>
|
||||
*
|
||||
* @example Determines the position of the element with the id '#wanted' among all li elements:
|
||||
* <pre>
|
||||
* var elementIndex = $('li').find($$('#wanted'));
|
||||
* </pre>
|
||||
*
|
||||
* @example Goes through the elements to find the first div that has the class 'myClass', and returns this element:
|
||||
* <pre>
|
||||
* var myClassElement = $('div').find(function(e) { if ($(e).is('.myClass')) return e; });
|
||||
* </pre>
|
||||
*
|
||||
* @param list A list to use as input. Can be an array, a ##list#Minified list## or any other array-like structure with
|
||||
* <var>length</var> property.
|
||||
* @param findFunc The callback <code>function(item, index)</code> that will be invoked for every list item until it returns a non-null value:
|
||||
* <dl><dt>item</dt><dd>The current list element.</dd><dt>index</dt><dd>The second the zero-based index of the current element.</dd>
|
||||
* <dt class="this">this</dt><dd>This list.</dd>
|
||||
* <dt class="returnValue">(callback return value)</dt><dd>If the callback returns something other than <var>null</var> or
|
||||
* <var>undefined</var>, <var>find()</var> will return it directly. Otherwise it will continue. </dd></dl>
|
||||
* @param element the element to search for
|
||||
* @param startIndex optional the 0-based index of the first element to search.
|
||||
* @return if called with an element, either the element's index in the list or <var>undefined</var> if not found. If called with a callback function,
|
||||
* it returns either the value returned by the callback or <var>undefined</var>.
|
||||
*
|
||||
* @see ##findLast() is the equivalent to <var>find()</var> for the list's end.
|
||||
*/
|
||||
'find': listBind(find),
|
||||
|
||||
/*$
|
||||
* @stop
|
||||
*/
|
||||
@@ -2559,6 +2623,9 @@ define('minified', function() {
|
||||
// @condblock each
|
||||
'toObject': toObject,
|
||||
// @condend
|
||||
// @condblock find
|
||||
'find': find,
|
||||
// @condend
|
||||
|
||||
/*$
|
||||
* @id copyobj
|
||||
|
||||
Reference in New Issue
Block a user