| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. |
| 5 |
| 6 It contains the definition of the following Behaviors: |
| 7 |
| 8 SwarmingBehaviors.CommonBehavior |
| 9 |
| 10 To use it, include |
| 11 behaviors: [SwarmingBehaviors.CommonBehavior] |
| 12 in the creation of any Polymer element. |
| 13 |
| 14 SwarmingBehaviors.CommonBehavior contains shared functions to ease |
| 15 templating, such as _or() and _not(). |
| 16 --> |
| 17 |
| 18 <script> |
| 19 window.SwarmingBehaviors = window.SwarmingBehaviors || {}; |
| 20 (function(){ |
| 21 // This behavior wraps up all the shared swarming functionality. |
| 22 SwarmingBehaviors.CommonBehavior = { |
| 23 |
| 24 _not: function(a) { |
| 25 return !a; |
| 26 }, |
| 27 |
| 28 _or: function() { |
| 29 var result = false; |
| 30 // can't use .foreach, as arguments isn't really an Array. |
| 31 for (var i = 0; i < arguments.length; i++) { |
| 32 result = result || arguments[i]; |
| 33 } |
| 34 return result; |
| 35 }, |
| 36 }; |
| 37 })(); |
| 38 </script> |
| OLD | NEW |