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

Side by Side Diff: appengine/swarming/elements/res/imp/common/interval-timer.html

Issue 2350853004: Make the buttons on task-page work (Closed) Base URL: git@github.com:luci/luci-py@task-page2
Patch Set: Rebuild Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(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 The interval-timer element fires the trigger event repeatedly using a
7 configurable property.
8
9 Properties:
10 period - The number of seconds that should elapse before the trigger event f ires. After
11 firing, the timer resets. If the period is changed, the timer is also res et. -1 means to
12 stop the timer.
13
14 Methods:
15 None.
16
17 Events:
18 trigger - The specified time has come to perform some event. The event obje ct will have the
19 following attributes:
20 period: Number, the period that was used to create the event.
21 -->
22 <dom-module id="interval-timer">
23 <script>
24 (function() {
25 Polymer({
26 is: "interval-timer",
27
28 properties: {
29 period: {
30 type: Number,
31 value: -1, // by default, never fire.
32 observer: "_periodChanged",
33 },
34 },
35
36 _periodChanged: function(period) {
37 if (this.timeout) {
jcgregorio 2016/09/21 14:22:03 rename timeout -> _timeout since it isn't a public
kjlubick 2016/09/21 14:51:38 Done.
38 window.clearTimeout(this.timeout);
39 }
40 if (period > 0) {
41 this.timeout = window.setTimeout(function() {
42 this.fire('trigger');
43 // refire event
44 this._periodChanged(period);
45 }.bind(this), period * 1000);
46 }
47 },
48 });
49 }());
50 </script>
51 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698