-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy get handler is used when evaluating the proxy #16483
Comments
kuanee
changed the title
Proxy getter raises on evaluation of proxy
Proxy get handler is used when evaluating the proxy
Oct 25, 2017
I think missing from your description is that it happens in the REPL? |
There are some properties that are requested during REPL evaluation of an Object. You can filter them out: 'use strict';
const util = require('util');
const o1 = {
ready: false,
};
setTimeout(() => {
o1.ready = true;
}, 1000000000);
const handler = {
get(target, propKey, receiver) {
const filter = ['inspect', util.inspect.custom, Symbol.iterator];
if (!filter.includes(propKey)) {
if (target.ready === false) {
throw new Error('not ready');
} else {
return 'ready';
}
}
},
};
const proxy = new Proxy(o1, handler);
proxy; // does not raise 'not ready' |
vsemozhetbyt
added
repl
Issues and PRs related to the REPL subsystem.
util
Issues and PRs related to the built-in util module.
labels
Oct 25, 2017
bnoordhuis
added a commit
to bnoordhuis/io.js
that referenced
this issue
Oct 25, 2017
#16485 - possible solution. |
yup, encountered this in repl. Thanks alot! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The defined 'not ready' error is raised when evaluating the proxy. This error does not occur in chrome or firefox consoles.
The text was updated successfully, but these errors were encountered: