Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1916)

Side by Side Diff: chrome/browser/resources/shared/js/cr/ui/array_data_model.js

Issue 2935011: Initial accounts options page. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: use ListItem directly for now per arv Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview This is a data model representin 6 * @fileoverview This is a data model representin
7 */ 7 */
8 8
9 cr.define('cr.ui', function() { 9 cr.define('cr.ui', function() {
10 const EventTarget = cr.EventTarget; 10 const EventTarget = cr.EventTarget;
(...skipping 15 matching lines...) Expand all
26 /** 26 /**
27 * The length of the data model. 27 * The length of the data model.
28 * @type {number} 28 * @type {number}
29 */ 29 */
30 get length() { 30 get length() {
31 return this.array_.length; 31 return this.array_.length;
32 }, 32 },
33 33
34 /** 34 /**
35 * Returns the item at the given index. 35 * Returns the item at the given index.
36 * @param {number} index The index of the element go get. 36 * @param {number} index The index of the element to get.
37 * @return {*} The element at the given index. 37 * @return {*} The element at the given index.
38 */ 38 */
39 item: function(index) { 39 item: function(index) {
40 return this.array_[index]; 40 return this.array_[index];
41 }, 41 },
42 42
43 /** 43 /**
44 * Returns the first matching item. 44 * Returns the first matching item.
45 * @param {*} item The item to find. 45 * @param {*} item The item to find.
46 * @param {number=} opt_fromIndex If provided, then the searching start at 46 * @param {number=} opt_fromIndex If provided, then the searching start at
47 * the {@code opt_fromIndex}. 47 * the {@code opt_fromIndex}.
48 * @return {number} The index of the first found element or -1 if not found. 48 * @return {number} The index of the first found element or -1 if not found.
49 */ 49 */
50 indexOf: function(item, opt_fromIndex) { 50 indexOf: function(item, opt_fromIndex) {
51 return this.array_.indexOf(item, opt_fromIndex); 51 return this.array_.indexOf(item, opt_fromIndex);
52 }, 52 },
53 53
54 /** 54 /**
55 * Returns an array of elements in a selected range.
56 * @param {number=} opt_from The starting index of the selected range.
57 * @param {number=} opt_to The ending index of selected range.
58 * @return {Array} An array of elements in the selected range.
59 */
60 slice: function(opt_from, opt_to) {
61 return this.array_.slice.apply(this.array_, arguments);
62 },
63
64 /**
55 * This removes and adds items to the model. 65 * This removes and adds items to the model.
56 * 66 *
57 * This dispatches a splice event. 67 * This dispatches a splice event.
58 * 68 *
59 * @param {number} index The index of the item to update. 69 * @param {number} index The index of the item to update.
60 * @param {number} deleteCount The number of items to remove. 70 * @param {number} deleteCount The number of items to remove.
61 * @param {...*} The items to add. 71 * @param {...*} The items to add.
62 * @return {!Array} An array with the removed items. 72 * @return {!Array} An array with the removed items.
63 */ 73 */
64 splice: function(index, deleteCount, var_args) { 74 splice: function(index, deleteCount, var_args) {
(...skipping 28 matching lines...) Expand all
93 var e = new Event('change'); 103 var e = new Event('change');
94 e.index = index; 104 e.index = index;
95 this.dispatchEvent(e); 105 this.dispatchEvent(e);
96 } 106 }
97 }; 107 };
98 108
99 return { 109 return {
100 ArrayDataModel: ArrayDataModel 110 ArrayDataModel: ArrayDataModel
101 }; 111 };
102 }); 112 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/preferences.js ('k') | chrome/browser/resources/shared/js/cr/ui/list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698