Answer the question
In order to leave comments, you need to log in
Why is object proxying not working in nodejs?
Tell me why, when writing in file B, the proxy in file A does not react?
A
'use strict'
const ws = require('./b');
var data_store = [];
var proxy = new Proxy(data_store, {
set(target, prop, value) {
console.log(`Запись ${prop} ${value}`);
target[prop] = value;
return true;
}
});
exports.proxy = proxy;
const proxy = require('./a');
console.log(proxy);
function handle() {
proxy['asd'] = 'asd';
console.log('write');
}
handle();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question