⚡ Sangsakala Proxy 🏠 Home
Skip to content

Commit 2cd0a57

Browse files
committed
Add revocable Proxy example
1 parent cf9403e commit 2cd0a57

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎JavaScript/b-revocable.js‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
const data = { name: 'Marcus' };
4+
5+
const { proxy, revoke } = Proxy.revocable(data, {
6+
get: function(target, key) {
7+
return '[[' + target[key] + ']]';
8+
}
9+
});
10+
11+
console.log(proxy.name);
12+
revoke();
13+
console.log(proxy.name);

0 commit comments

Comments
 (0)