Skip to content

Commit 9355899

Browse files
authored
Merge pull request #119 from sylingd/fix/element-cache
fix: remove web cache
2 parents 2692aaf + 3b5091f commit 9355899

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

packages/element/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "universal-element",
33
"author": "rax",
4-
"version": "0.0.5",
4+
"version": "0.0.6",
55
"description": "",
66
"main": "lib/index.js",
77
"files": [

packages/element/src/Cache.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Context } from './types';
55
declare const my: any;
66
declare const wx: any;
77
export default class Cache {
8-
private cache = {};
98
public getSelector(selector: string, context?: Context) {
109
if (isMiniApp && !isWeb) {
1110
const selectorQuery = my.createSelectorQuery().selectAll(selector);
@@ -17,10 +16,8 @@ export default class Cache {
1716
const selectorQuery = context?.createSelectorQuery().selectAll(selector);
1817
return selectorQuery;
1918
} else {
20-
if (this.cache[selector]) return this.cache[selector];
2119
// Transform NodeList to Array
2220
const nodes = Array.from(document.querySelectorAll(selector));
23-
this.cache[selector] = nodes;
2421
return nodes;
2522
}
2623
}

0 commit comments

Comments
 (0)