UNPKG

@sen-use/web3

Version:
16 lines (15 loc) 490 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DataLoader = void 0; const mapCache = new Map(); class DataLoader { static load(requestKey, callback, force = false) { const instantId = JSON.stringify(requestKey); const cache = mapCache.get(instantId); if (cache && !force) return cache; mapCache.set(instantId, callback()); return mapCache.get(instantId); } } exports.DataLoader = DataLoader;