update, text, response
This commit is contained in:
2
node_modules/memoizee/ext/async.js
generated
vendored
2
node_modules/memoizee/ext/async.js
generated
vendored
@@ -28,7 +28,7 @@ require("../lib/registered-extensions").async = function (tbi, conf) {
|
||||
currentCallback = last;
|
||||
args = slice.call(args, 0, -1);
|
||||
}
|
||||
return base.apply(currentContext = this, currentArgs = args);
|
||||
return base.apply((currentContext = this), (currentArgs = args));
|
||||
}, base);
|
||||
try { mixin(conf.memoized, base); }
|
||||
catch (ignore) {}
|
||||
|
||||
22
node_modules/memoizee/ext/dispose.js
generated
vendored
22
node_modules/memoizee/ext/dispose.js
generated
vendored
@@ -5,29 +5,23 @@
|
||||
var callable = require("es5-ext/object/valid-callable")
|
||||
, forEach = require("es5-ext/object/for-each")
|
||||
, extensions = require("../lib/registered-extensions")
|
||||
|
||||
, apply = Function.prototype.apply;
|
||||
, apply = Function.prototype.apply;
|
||||
|
||||
extensions.dispose = function (dispose, conf, options) {
|
||||
var del;
|
||||
callable(dispose);
|
||||
if ((options.async && extensions.async) || (options.promise && extensions.promise)) {
|
||||
conf.on("deleteasync", del = function (id, resultArray) {
|
||||
apply.call(dispose, null, resultArray);
|
||||
});
|
||||
conf.on(
|
||||
"deleteasync",
|
||||
(del = function (id, resultArray) { apply.call(dispose, null, resultArray); })
|
||||
);
|
||||
conf.on("clearasync", function (cache) {
|
||||
forEach(cache, function (result, id) {
|
||||
del(id, result);
|
||||
});
|
||||
forEach(cache, function (result, id) { del(id, result); });
|
||||
});
|
||||
return;
|
||||
}
|
||||
conf.on("delete", del = function (id, result) {
|
||||
dispose(result);
|
||||
});
|
||||
conf.on("delete", (del = function (id, result) { dispose(result); }));
|
||||
conf.on("clear", function (cache) {
|
||||
forEach(cache, function (result, id) {
|
||||
del(id, result);
|
||||
});
|
||||
forEach(cache, function (result, id) { del(id, result); });
|
||||
});
|
||||
};
|
||||
|
||||
19
node_modules/memoizee/ext/max.js
generated
vendored
19
node_modules/memoizee/ext/max.js
generated
vendored
@@ -13,14 +13,19 @@ extensions.max = function (max, conf, options) {
|
||||
if (!max) return;
|
||||
|
||||
queue = lruQueue(max);
|
||||
postfix = (options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async" : "";
|
||||
postfix =
|
||||
(options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async"
|
||||
: "";
|
||||
|
||||
conf.on("set" + postfix, hit = function (id) {
|
||||
id = queue.hit(id);
|
||||
if (id === undefined) return;
|
||||
conf.delete(id);
|
||||
});
|
||||
conf.on(
|
||||
"set" + postfix,
|
||||
(hit = function (id) {
|
||||
id = queue.hit(id);
|
||||
if (id === undefined) return;
|
||||
conf.delete(id);
|
||||
})
|
||||
);
|
||||
conf.on("get" + postfix, hit);
|
||||
conf.on("delete" + postfix, queue.delete);
|
||||
conf.on("clear" + postfix, queue.clear);
|
||||
|
||||
32
node_modules/memoizee/ext/ref-counter.js
generated
vendored
32
node_modules/memoizee/ext/ref-counter.js
generated
vendored
@@ -2,30 +2,24 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, extensions = require("../lib/registered-extensions")
|
||||
|
||||
, create = Object.create, defineProperties = Object.defineProperties;
|
||||
var d = require("d")
|
||||
, extensions = require("../lib/registered-extensions")
|
||||
, create = Object.create
|
||||
, defineProperties = Object.defineProperties;
|
||||
|
||||
extensions.refCounter = function (ignore, conf, options) {
|
||||
var cache, postfix;
|
||||
|
||||
cache = create(null);
|
||||
postfix = (options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async" : "";
|
||||
postfix =
|
||||
(options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async"
|
||||
: "";
|
||||
|
||||
conf.on("set" + postfix, function (id, length) {
|
||||
cache[id] = length || 1;
|
||||
});
|
||||
conf.on("get" + postfix, function (id) {
|
||||
++cache[id];
|
||||
});
|
||||
conf.on("delete" + postfix, function (id) {
|
||||
delete cache[id];
|
||||
});
|
||||
conf.on("clear" + postfix, function () {
|
||||
cache = {};
|
||||
});
|
||||
conf.on("set" + postfix, function (id, length) { cache[id] = length || 1; });
|
||||
conf.on("get" + postfix, function (id) { ++cache[id]; });
|
||||
conf.on("delete" + postfix, function (id) { delete cache[id]; });
|
||||
conf.on("clear" + postfix, function () { cache = {}; });
|
||||
|
||||
defineProperties(conf.memoized, {
|
||||
deleteRef: d(function () {
|
||||
@@ -43,6 +37,6 @@ extensions.refCounter = function (ignore, conf, options) {
|
||||
if (id === null) return 0;
|
||||
if (!cache[id]) return 0;
|
||||
return cache[id];
|
||||
})
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user