-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
58 lines (46 loc) · 1.06 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="ProxyStats.js"></script>
</head>
<body>
<script>
function slowFunction(min, max) {
const end = Date.now() + Math.round(min + Math.random() * (max - min));
while (Date.now() < end) { }
}
class ExampleClass {
aProperty = 'some property'
get aGetter() {
slowFunction(50, 50);
return 'some getter';
}
set aGetter($value) {
slowFunction(50, 50);
}
aFunction() {
slowFunction(50, 50);
}
aRecursiveFunction(depth) {
slowFunction(50, 50);
if (--depth > 0) {
this.aRecursiveFunction(depth);
}
}
}
const exampleObject = ProxyStats.watch(new ExampleClass());
exampleObject.aProperty;
exampleObject.aGetter;
exampleObject.aGetter;
exampleObject.aGetter = '';
exampleObject.aFunction();
exampleObject.aFunction();
exampleObject.aRecursiveFunction(2);
exampleObject.aRecursiveFunction(2);
ProxyStats.watch(new ExampleClass(), 'a').aGetter;
ProxyStats.watch(new ExampleClass(), 'a').aGetter;
ProxyStats.watch(new ExampleClass(), 'b').aGetter;
</script>
</body>
</html>