Skip to main content

All Questions

Tagged with or
0 votes
1 answer
140 views

I'm attempting to create an undetectable method of overriding the Error object in JavaScript without triggering standard detection mechanisms. My goal is to modify the Error prototype or constructor ...
a.gulcan's user avatar
  • 307
2 votes
1 answer
103 views

I modify the handler object after proxy's creation, and obtain intended result. But nowhere in mdn document such pattern, can i rely on this pattern to work consistently across browser/in future? ...
StructSeeker's user avatar
1 vote
1 answer
106 views

enter image description here const globalProxy = new Proxy(win.window, { get(target, p, receiver){ // return undefined return Reflect.get(target, p, receiver); // there is a value // ...
snick8090's user avatar
1 vote
0 answers
80 views

I may be guilty of a bit of an XY question here, but I'm doing this out of theoretical interest rather than any immediate need. My goal is, ultimately, to build a lightweight framework that allows me ...
Tom Auger's user avatar
  • 20.2k
0 votes
0 answers
100 views

I need to wrap an immutable object coming from 3rd party code to (a) override some methods and (b) to catch non-existing properties/methods because the object throws an error if a property/method does ...
droptix's user avatar
  • 105
-1 votes
1 answer
62 views

I want to intercept function calls and found that proxies can do that as shown here on MDN using the apply method. However what I quickly found out is that the params passed to the function are not ...
inux's user avatar
  • 123
0 votes
1 answer
95 views

I'm trying to proxy the [[set]] method on JavaScript arrays. Is it possible to proxy all arrays, and not just a specific one? My handler would check the object being set in the array and if it ...
enbyte's user avatar
  • 11
3 votes
1 answer
116 views

Consider the following Proxy object: let proxy = new Proxy({}, handler); If I perform the following assignment, the proxy instance will be overwriten, losing the trap handlers: proxy = {}; Alright, ...
Pedro Henrique's user avatar
2 votes
1 answer
139 views

I wanted to create a short documentation and explain the principle of Angular Signals using JavaScript proxies in an example. Then the question came up: could I quickly write it in TypeScript and set ...
Webia1's user avatar
  • 577
0 votes
1 answer
59 views

I have a two dimensional array that I need to perform read and write action on from various angles. Sometimes I need to get/set a single row (easy of course) and sometimes I need to get/set a single ...
Christian Schäfer's user avatar
-1 votes
1 answer
88 views

A couple of years ago, I wanted figure how to create a type check for class A that returns true only for objects instantiated by new A(). For this, I wrote the class like this: class A { static #...
Melab's user avatar
  • 2,986
0 votes
1 answer
442 views

Steps to reproduce: Open the reproduction Open the browser console When the project starts it will errors with: Uncaught (in promise) DOMException: Failed to execute 'put' on 'IDBObjectStore': #<...
Fred Hors's user avatar
  • 3,853
0 votes
1 answer
199 views

I need to Proxy a window object opened with window.open. So far as I understand it (which is not well), the trivial "handler" here should effectively be the identity operation, passing thru ...
Boann's user avatar
  • 50.3k
0 votes
1 answer
54 views

I have a function that takes an object and returns a proxied version of this object, which can be mutated without affecting the original object. const createProxy4 = (obj) => { const handler = { ...
Black Beard's user avatar
  • 1,656
0 votes
1 answer
79 views

I'm trying to mock knex for testing. Everything seems to work but attaching a proxy to an array as prototype seems to remove the iteratability of arrays. Here is the mock function. Following works ...
srinesha's user avatar

15 30 50 per page
1
2 3 4 5
22