update, text, response

This commit is contained in:
2025-11-02 11:09:14 +01:00
parent 14776c86b0
commit eed8a4ddcf
2794 changed files with 156786 additions and 129204 deletions

View File

@@ -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];
})
}),
});
};