mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
fix(pipe) on: memory lick
This commit is contained in:
parent
df634234e0
commit
a471f7dbaf
1 changed files with 10 additions and 5 deletions
|
|
@ -24,7 +24,7 @@
|
|||
function create(params) {
|
||||
var gzip, read, write, isFsWrite,
|
||||
p = params,
|
||||
func = Util.exec.ret(p.callback),
|
||||
func = p.callback,
|
||||
options = {
|
||||
bufferSize: 4 * 1024
|
||||
};
|
||||
|
|
@ -71,11 +71,16 @@
|
|||
}
|
||||
|
||||
function on(event, emitter, callback) {
|
||||
var listeners = emitter.listeners(event),
|
||||
indexOf = listeners.indexOf(callback);
|
||||
var isSet,
|
||||
listeners = emitter.listeners(event),
|
||||
callbackStr = '' + callback;
|
||||
|
||||
if (!~indexOf)
|
||||
emitter.once(event, callback);
|
||||
isSet = listeners.some(function(func) {
|
||||
return '' + func === callbackStr;
|
||||
});
|
||||
|
||||
if (!isSet)
|
||||
emitter.on(event, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue