Skip to content

Commit

Permalink
A bit less agressive with changes, we still use the regular setInterv…
Browse files Browse the repository at this point in the history
…al in the background.
  • Loading branch information
bcoe committed May 11, 2012
1 parent 4e21820 commit 201ca77
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/queuebert.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/background-client.js
Expand Up @@ -16,6 +16,7 @@ if (!Queuebert.Client && typeof(require) !== 'undefined' && typeof(exports) !==
this.identifier = params.identifier || 'background';
this.server = params.server;
this.messageInterval = params.messageInterval || 150;
this.setInterval = params.setInterval || function(callback, time) { setInterval(callback, time); };

this.sendRequest = function(request, callback) {
if (request.type == 'get') {
Expand Down
3 changes: 2 additions & 1 deletion lib/client.js
Expand Up @@ -9,6 +9,7 @@ if (typeof(Queuebert) === 'undefined') {
this.identifier = params.identifier;
this.messageInterval = params.messageInterval || 150;
this.sendRequest = params.sendRequest || chrome.extension.sendRequest;
this.setInterval = params.setInterval || function(callback, time) { setInterval(callback, time); };

if (params.start === undefined || params.start) {
this.start();
Expand All @@ -18,7 +19,7 @@ if (typeof(Queuebert) === 'undefined') {
Client.prototype.start = function() {
var _this = this;

setInterval(function() {
this.setInterval(function() {
_this.sendRequest({from: _this.identifier, type: 'get'}, function(rawMessage) {
if (rawMessage) {
_this.handleMessage(rawMessage.action, rawMessage.from, rawMessage.tabId, rawMessage.body, rawMessage.callback);
Expand Down

0 comments on commit 201ca77

Please sign in to comment.