diff --git a/wire.js b/wire.js index 18c68f9..65bd037 100755 --- a/wire.js +++ b/wire.js @@ -11,18 +11,18 @@ let pipeLine = function(){ this.reads = []; this.writes = []; - this.read = (fn,pr) => reads.push({fn,pr}); - this.write = (fn,pr) => writes.push({fn,pr}); + this.read = (fn,pr) => this.reads.push({fn,pr}); + this.write = (fn,pr) => this.writes.push({fn,pr}); this.get = (val) => { - let fns = reads.sort((a,b) => (a?.pr|0) - (b?.pr|0)), + let fns = this.reads.sort((a,b) => (a?.pr|0) - (b?.pr|0)), real = val; for (const { fn } of fns) { fn( real, e => real = e ); }; return real; }; - this.set = () => { - let fns = writes.sort((a,b) => (a?.pr|0) - (b?.pr|0)), + this.set = (val) => { + let fns = this.writes.sort((a,b) => (a?.pr|0) - (b?.pr|0)), real = val; for (const { fn } of fns) { fn( real, e => real = e ); @@ -284,13 +284,13 @@ é.prototype.equalTo = function(value){ return é.isSame(value, this.value) } - é.prototype.readLayer = function(value){ + é.prototype.readLayer = function(fn,priority){ this.flag = this.flag | 2; - this.piping.read(a,b) + this.piping.read(fn,priority) } - é.prototype.writeLayer = function(value){ + é.prototype.writeLayer = function(fn,priority){ this.flag = this.flag | 4; - this.piping.write(a,b) + this.piping.write(fn,priority) } try{ module.exports = é;