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

Unified Diff: ui/webui/resources/js/cr/ui/array_data_model.js

Issue 1855393006: [Chrome Settings UI] If User Exceptions are not allowed, prevent editing / viewing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding and using ArrayDataModel.pop(). Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/webui/resources/js/cr/ui/array_data_model.js
diff --git a/ui/webui/resources/js/cr/ui/array_data_model.js b/ui/webui/resources/js/cr/ui/array_data_model.js
index 969f9484ff8a295571d2c87f12929e24b71bfde3..552e7cb0d1c788627b4b7a5b167c44ca8e5ddad3 100644
--- a/ui/webui/resources/js/cr/ui/array_data_model.js
+++ b/ui/webui/resources/js/cr/ui/array_data_model.js
@@ -222,6 +222,18 @@ cr.define('cr.ui', function() {
},
/**
+ * Removes and returns the last item of the model.
+ *
+ * This dispatches a splice event.
+ *
+ * @return {*} The last item, or undefined if model has no more items.
Dan Beam 2016/04/27 21:47:27 we should @template-ize this class some day
huangs 2016/04/27 21:53:13 Don't understand what you mean?
+ */
+ pop: function() {
+ var deletedItems = this.splice(this.array_.length - 1, 1);
+ return deletedItems.length > 0 ? deletedItems[0] : undefined;
Dan Beam 2016/04/27 21:47:27 return this.splice(this.array_.length - 1, 1)[0];
huangs 2016/04/27 21:53:13 Done.
+ },
+
+ /**
* Updates the existing item with the new item.
*
* The existing item and the new item are regarded as the same item and the

Powered by Google App Engine
This is Rietveld 408576698