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

Unified Diff: appengine/swarming/elements/res/imp/common/common-behavior.html

Issue 2269643002: Extract shared filters and aliasing code (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Address nit Created 4 years, 4 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/swarming/elements/res/imp/common/common-behavior.html
diff --git a/appengine/swarming/elements/res/imp/common/common-behavior.html b/appengine/swarming/elements/res/imp/common/common-behavior.html
new file mode 100644
index 0000000000000000000000000000000000000000..4aefc6b700acf9b6d5ac08ecd982003c36a968e6
--- /dev/null
+++ b/appengine/swarming/elements/res/imp/common/common-behavior.html
@@ -0,0 +1,38 @@
+<!--
+ Copyright 2016 The LUCI Authors. All rights reserved.
+ Use of this source code is governed under the Apache License, Version 2.0
+ that can be found in the LICENSE file.
+
+ It contains the definition of the following Behaviors:
+
+ SwarmingBehaviors.CommonBehavior
+
+ To use it, include
+ behaviors: [SwarmingBehaviors.CommonBehavior]
+ in the creation of any Polymer element.
+
+ SwarmingBehaviors.CommonBehavior contains shared functions to ease
+ templating, such as _or() and _not().
+ -->
+
+<script>
+ window.SwarmingBehaviors = window.SwarmingBehaviors || {};
+ (function(){
+ // This behavior wraps up all the shared swarming functionality.
+ SwarmingBehaviors.CommonBehavior = {
+
+ _not: function(a) {
+ return !a;
+ },
+
+ _or: function() {
+ var result = false;
+ // can't use .foreach, as arguments isn't really an Array.
+ for (var i = 0; i < arguments.length; i++) {
+ result = result || arguments[i];
+ }
+ return result;
+ },
+ };
+ })();
+</script>

Powered by Google App Engine
This is Rietveld 408576698