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

Unified Diff: appengine/config_service/ui/bower_components/polymer/lib/utils/mixin.html

Issue 2923973003: Added base template for config ui. (Closed)
Patch Set: Created 3 years, 6 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: appengine/config_service/ui/bower_components/polymer/lib/utils/mixin.html
diff --git a/appengine/config_service/ui/bower_components/polymer/lib/utils/mixin.html b/appengine/config_service/ui/bower_components/polymer/lib/utils/mixin.html
new file mode 100644
index 0000000000000000000000000000000000000000..12a4ebb3c803794e71425834c623cec5fff5b675
--- /dev/null
+++ b/appengine/config_service/ui/bower_components/polymer/lib/utils/mixin.html
@@ -0,0 +1,76 @@
+<!--
+@license
+Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+-->
+
+<link rel="import" href="boot.html">
+
+<script>
+
+(function() {
+
+ 'use strict';
+
+ // unique global id for deduping mixins.
+ let dedupeId = 0;
+
+ /**
+ * Given a mixin producing function, memoize applications of mixin to base
+ * @private
+ * @param {Function} mixin Mixin for which to create a caching mixin.
+ * @return {Function} Returns a mixin which when applied multiple times to the
+ * same base will always return the same extended class.
+ */
+ function cachingMixin(mixin) {
+ return function(base) {
+ if (!mixin.__mixinApplications) {
+ mixin.__mixinApplications = new WeakMap();
+ }
+ let map = mixin.__mixinApplications;
+ let application = map.get(base);
+ if (!application) {
+ application = mixin(base);
+ map.set(base, application);
+ }
+ return application;
+ };
+ }
+
+ /**
+ * Wraps an ES6 class expression mixin such that the mixin is only applied
+ * if it has not already been applied its base argument. Also memoizes mixin
+ * applications.
+ *
+ * @memberof Polymer
+ * @param {Function} mixin ES6 class expression mixin to wrap
+ * @return {Function} Wrapped mixin that deduplicates and memoizes
+ * mixin applications to base
+ */
+ Polymer.dedupingMixin = function(mixin) {
+ mixin = cachingMixin(mixin);
+ // maintain a unique id for each mixin
+ mixin.__dedupeId = ++dedupeId;
+ return function(base) {
+ let baseSet = base.__mixinSet;
+ if (baseSet && baseSet[mixin.__dedupeId]) {
+ return base;
+ }
+ let extended = mixin(base);
+ // copy inherited mixin set from the extended class, or the base class
+ // NOTE: we avoid use of Set here because some browser (IE11)
+ // cannot extend a base Set via the constructor.
+ extended.__mixinSet =
+ Object.create(extended.__mixinSet || baseSet || null);
+ extended.__mixinSet[mixin.__dedupeId] = true;
+ return extended;
+ }
+ };
+
+})();
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698