Questions tagged [es6-proxy]
The ES2015 Proxy object allows the creation of objects with custom dispatch semantics for operations like property lookup, assignment, enumeration, invocation as a function or constructor.
es6-proxy
308
questions
0
votes
1
answer
113
views
Value of this inside a Proxy trap
I have the following code:
function delay(f, ms) {
return new Proxy(f, {
apply(target, thisArg, args) {
console.log(this)
console.log(thisArg)
...
0
votes
0
answers
318
views
JavaScript Error: caught (in promise) TypeError: 'set' on proxy: trap returned falsish for property
I'm attempting to add an "eventlistener" of sorts to trigger when all of the application resources have completed loading. If I understand Proxies correctly, "this is the way" to ...
1
vote
1
answer
374
views
Is it possible to get parent property name of nested object in set method of Proxy object?
https://stackoverflow.com/a/41300128
↑ completely based on this code
var validator = {
get(target, key) {
if (typeof target[key] === 'object' && target[key] !== null) {
return new ...
0
votes
1
answer
34
views
How do I roll back the values of the items or collections after an unexpected error?
<q-select v-model="item" :options="colect">
<q-input v-model="item.name">
const colect = ref([... ])
const item = ref({... })
The dilemma is that, when ...
0
votes
1
answer
48
views
Why object is not proxied like an argument in function
i have an interesting example of code that's not working like i'm expected.
I really dont understand why my obj wouldnt proxy.
I'm expect that obj ill proxy via link, but it's not. Can anyone explain ...
0
votes
1
answer
840
views
TypeScript types for Proxy with dynamic properties
I want to type a JavaScript Proxy that allows access to arbitrary properties. A contrived example, an object that maps every property to it's own property name:
const proxy = new Proxy({}, {
get(...
5
votes
3
answers
7k
views
'get' on proxy: property 'items' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value
What does this JavaScript error actually mean? I'm not asking about my specific case, just generally how is this error message meant to be understood?
TypeError: 'get' on proxy: property 'items' is a ...
0
votes
0
answers
18
views
React - Use JavaScript Proxy Object to update with Custom Hook [duplicate]
I am seeing a weird behavior with a simple custom React Hook I am trying to come up with. Any ideas on why it's not working as intended would be greatly appreciated.
So I have a custom hook called ...
1
vote
0
answers
26
views
argument is `undefined` in reflection function call [duplicate]
I have the following functional logic code:
const trans = {}
trans['toCssClass'] = (someListing) => {
// <-- someListing here is undefined
console.log(someListing)
someListing.a = ...
0
votes
0
answers
175
views
How to Proxy Built-In JS Object?
I want to proxy some built in object primitives in JS, for example, “Number” or “String” object wrappers. However it seems the Proxy object ends up reporting as a normal JS object when passed to some ...
1
vote
0
answers
1k
views
Javascript Proxy Object in React Custom Hook
I have 2 custom hooks useFormInput and other useFormInputWithoutProxies which is using Javascript proxy
My Question what benefit does Javascript proxy provides over creating normal custom hooks ?
Can ...
0
votes
0
answers
1k
views
property 'prototype' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value
I want interception object with proxy,but I can’t understand why I report an error
function createReactiveObject(target) {
if (!isObject(target)) {
return target;
}
return ...
1
vote
1
answer
119
views
Can I extend default javascript function prototype to let some code been executed on every function call?
Lets say there are functions
function a(someparams){
console.log('a called')
}
function b(){
console.log('b called')
}
...
const c (someParam) => { console.log('c called')}
I want to extend ...
1
vote
1
answer
827
views
Javascript proxy for nested object (apply for all function calls)
I'm looking for away to use a proxy on a nested object. In this example I would like to add 1 in my proxy for the result of every function call in that object. How would I go about this, since I can't ...
0
votes
1
answer
123
views
How to make a web component return a Proxy (and be extended)
The goal is to have a base class A extending HTMLElement that customizes getters and setters. Then class B would extend class A and do stuff.
The way to do this is by wrapping class A with a proxy (...