Permalink
Browse files

Added code to read and use preference values.

  • Loading branch information...
1 parent 6b690af commit c3e1954094664836ac835faea3a4eb3f94236890 @justmoon justmoon committed with NV Mar 20, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 Firefox/content/background-firefox.js
View
@@ -4,6 +4,24 @@ LivereloadBackgroundFirefox.prototype = new LivereloadBackground(function reload
client.reload(data);
});
+LivereloadBackgroundFirefox.prototype.connect = function () {
+ var self = this;
+
+ this.prefs = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefService)
+ .getBranch("livereload.");
+ this.prefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
+ this.prefs.addObserver("", {observe: function () {
+ self.disconnect();
+ }}, false);
+
+ this.host = this.prefs.getCharPref("host");
+
+ this.port = this.prefs.getIntPref("port");
+
+ this.__proto__.__proto__.connect.call(this);
+};
+
LivereloadBackgroundFirefox.prototype.sendPageUrl = function() {
var activeTab = this.lastPage;
if (activeTab == null) {

0 comments on commit c3e1954

Please sign in to comment.