mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 15:22:26 +01:00
Fix some brokenness
This commit is contained in:
@@ -32,7 +32,11 @@ const liberator = (function () //{{{
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
const threadManager = Components.classes["@mozilla.org/thread-manager;1"]
|
||||
.getService(Components.interfaces.nsIThreadManager);
|
||||
|
||||
var callbacks = [];
|
||||
var observers = [];
|
||||
|
||||
function loadModule(name, func)
|
||||
{
|
||||
@@ -627,12 +631,26 @@ const liberator = (function () //{{{
|
||||
for (let i = 0; i < callbacks.length; i++)
|
||||
{
|
||||
var [thistype, thismode, thisfunc] = callbacks[i];
|
||||
if (mode == liberator.modes.NONE || mode == thismode && type == thistype)
|
||||
if (mode == thismode && type == thistype)
|
||||
return thisfunc.call(this, data);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
registerObserver: function (type, callback)
|
||||
{
|
||||
observers.push([type, callback]);
|
||||
},
|
||||
|
||||
triggerObserver: function (type, data)
|
||||
{
|
||||
for (let [,[thistype, callback]] in Iterator(observers))
|
||||
{
|
||||
if (thistype == type)
|
||||
callback(data);
|
||||
}
|
||||
},
|
||||
|
||||
beep: function ()
|
||||
{
|
||||
if (liberator.options["visualbell"])
|
||||
@@ -1181,7 +1199,7 @@ const liberator = (function () //{{{
|
||||
|
||||
liberator.storage.saveAll();
|
||||
|
||||
liberator.triggerCallback("shutdown", 0, null);
|
||||
liberator.triggerObserver("shutdown", null);
|
||||
|
||||
liberator.dump("All liberator modules destroyed\n");
|
||||
|
||||
@@ -1190,8 +1208,6 @@ const liberator = (function () //{{{
|
||||
|
||||
sleep: function (ms)
|
||||
{
|
||||
var threadManager = Components.classes["@mozilla.org/thread-manager;1"]
|
||||
.getService(Components.interfaces.nsIThreadManager);
|
||||
var mainThread = threadManager.mainThread;
|
||||
|
||||
var then = new Date().getTime(), now = then;
|
||||
|
||||
Reference in New Issue
Block a user