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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/extensions/buildbot/bg.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/examples/extensions/buildbot/active_issues.js
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/active_issues.js b/chrome/common/extensions/docs/examples/extensions/buildbot/active_issues.js
new file mode 100644
index 0000000000000000000000000000000000000000..8f09eeef1886a08c86fbc37e59eb5995c71e885a
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/active_issues.js
@@ -0,0 +1,54 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function(){
+
+window.buildbot = window.buildbot || {};
+
+buildbot.ActiveIssues = function() {
+ this.issues_ = {};
+ this.eventCallback_ = null;
+};
+
+buildbot.ActiveIssues.prototype = {
+ forEach: function(callback) {
+ for (var key in this.issues_)
+ callback(this.issues_[key]);
+ },
+
+ getIssue: function(number) {
+ return this.issues_[number];
+ },
+
+ updateIssue: function(issue) {
+ var eventType = this.issues_.hasOwnProperty(issue.issue) ?
+ "issueUpdated" : "issueAdded";
+ this.issues_[issue.issue] = issue;
+ this.postEvent_({event: eventType, issue: issue.issue});
+ },
+
+ removeIssue: function(issue) {
+ delete this.issues_[issue.issue];
+ this.postEvent_({event: "issueRemoved", issue: issue.issue});
+ },
+
+ setEventCallback: function(callback) {
+ this.eventCallback_ = callback;
+ },
+
+ postEvent_: function(obj) {
+ if (this.eventCallback_)
+ this.eventCallback_(obj);
+ }
+};
+
+buildbot.getActiveIssues = function() {
+ var background = chrome.extension.getBackgroundPage();
+ if (!background.buildbot.hasOwnProperty("activeIssues"))
+ background.buildbot.activeIssues = new buildbot.ActiveIssues;
+
+ return background.buildbot.activeIssues;
+};
+
+})();
« 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