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

Side by Side Diff: chrome/common/extensions/docs/examples/extensions/buildbot/active_issues.js

Issue 18401004: Continuously update status in the buildbot extension popup window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add copyright Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/extensions/buildbot/bg.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (function(){
6
7 window.buildbot = window.buildbot || {};
8
9 buildbot.ActiveIssues = function() {
10 this.issues_ = {};
11 this.eventCallback_ = null;
12 };
13
14 buildbot.ActiveIssues.prototype = {
15 forEach: function(callback) {
16 for (var key in this.issues_)
17 callback(this.issues_[key]);
18 },
19
20 getIssue: function(number) {
21 return this.issues_[number];
22 },
23
24 updateIssue: function(issue) {
25 var eventType = this.issues_.hasOwnProperty(issue.issue) ?
26 "issueUpdated" : "issueAdded";
27 this.issues_[issue.issue] = issue;
28 this.postEvent_({event: eventType, issue: issue.issue});
29 },
30
31 removeIssue: function(issue) {
32 delete this.issues_[issue.issue];
33 this.postEvent_({event: "issueRemoved", issue: issue.issue});
34 },
35
36 setEventCallback: function(callback) {
37 this.eventCallback_ = callback;
38 },
39
40 postEvent_: function(obj) {
41 if (this.eventCallback_)
42 this.eventCallback_(obj);
43 }
44 };
45
46 buildbot.getActiveIssues = function() {
47 var background = chrome.extension.getBackgroundPage();
48 if (!background.buildbot.hasOwnProperty("activeIssues"))
49 background.buildbot.activeIssues = new buildbot.ActiveIssues;
50
51 return background.buildbot.activeIssues;
52 };
53
54 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/extensions/buildbot/bg.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698