mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 11:47:58 +01:00
Refactor download listeners a bit.
This commit is contained in:
@@ -41,26 +41,6 @@ var IO = Module("io", {
|
||||
|
||||
this._lastRunCommand = ""; // updated whenever the users runs a command with :!
|
||||
this._scriptNames = [];
|
||||
|
||||
this.downloadListener = {
|
||||
onDownloadStateChange: function (state, download) {
|
||||
if (download.state == services.downloadManager.DOWNLOAD_FINISHED) {
|
||||
let url = download.source.spec;
|
||||
let title = download.displayName;
|
||||
let file = download.targetFile.path;
|
||||
let size = download.size;
|
||||
|
||||
dactyl.echomsg({ domains: [util.getHost(url)], message: _("io.downloadFinished", title, file) },
|
||||
1, modules.commandline.ACTIVE_WINDOW);
|
||||
modules.autocommands.trigger("DownloadPost", { url: url, title: title, file: file, size: size });
|
||||
}
|
||||
},
|
||||
onStateChange: function () {},
|
||||
onProgressChange: function () {},
|
||||
onSecurityChange: function () {}
|
||||
};
|
||||
|
||||
services.downloadManager.addListener(this.downloadListener);
|
||||
},
|
||||
|
||||
CommandFileMode: Class("CommandFileMode", modules.CommandMode, {
|
||||
@@ -84,10 +64,6 @@ var IO = Module("io", {
|
||||
}
|
||||
}),
|
||||
|
||||
destroy: function destroy() {
|
||||
services.downloadManager.removeListener(this.downloadListener);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all directories named *name* in 'runtimepath'.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user