Chromium Code Reviews| Index: appengine/swarming/elements/res/imp/common/swarming-app.html |
| diff --git a/appengine/swarming/elements/res/imp/common/swarming-app.html b/appengine/swarming/elements/res/imp/common/swarming-app.html |
| index 27031dcb305d13a65aeda1ed2d19205ba603313e..1f424e6750dfd4adc9c0fda94537ca4f7f366265 100644 |
| --- a/appengine/swarming/elements/res/imp/common/swarming-app.html |
| +++ b/appengine/swarming/elements/res/imp/common/swarming-app.html |
| @@ -18,6 +18,17 @@ |
| <style include="shared-style"> contains styles to be shared among all |
| apps, such as colors. |
| + It contains the definition of the following Behaviors: |
| + |
| + SwarmingBehaviors.SwarmingBehavior |
| + |
| + To use it, include |
| + behaviors: [SwarmingBehaviors.SwarmingBehavior] |
| + in the creation of any Polymer element. |
| + |
| + SwarmingBehaviors.SwarmingBehavior contains shared functions to ease |
| + templating, such as _or() and _not(). |
| + |
| Properties: |
| auth_headers: Object, Use this in iron-ajax to set oauth2 headers. |
| busy: Boolean, If the busy spinner should be active. |
| @@ -135,4 +146,26 @@ |
| color: #1F78B4; |
| } |
| </style> |
| -</dom-module> |
| +</dom-module> |
| + |
| +<script> |
| + window.SwarmingBehaviors = window.SwarmingBehaviors || {}; |
| + (function(){ |
| + // This behavior wraps up all the shared swarming functionality. |
| + SwarmingBehaviors.SwarmingBehavior = { |
| + |
| + _not: function(a) { |
| + return !a; |
| + }, |
| + |
| + _or: function() { |
| + var result = false; |
| + // can't use .foreach, as arguments isn't really a function. |
|
jcgregorio
2016/08/16 12:09:27
isn't really an Array.
kjlubick
2016/08/16 12:29:46
Fixed.
|
| + for (var i = 0; i < arguments.length; i++) { |
| + result = result || arguments[i]; |
| + } |
| + return result; |
| + }, |
| + }; |
| + })(); |
| +</script> |