Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
125 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
3 votes
1 answer
95 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
101 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
74 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
96 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
52 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
80 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
103 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
115 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
58 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
415 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
  • 4,273
0 votes
1 answer
184 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
53 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
74 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
0 votes
1 answer
186 views

What could be the reason of me not being able to access the Proxy of the CustomPage class in my test file? I get this error... enter image description here const puppeteer = require("puppeteer&...
Aleksandregvrm's user avatar
0 votes
1 answer
72 views

A common trick sites use to protect against reverse engineering is to prevent Javascript from executing correctly when the developer tools are open. Usually, this relies on an object logged to the ...
user2248702's user avatar
  • 3,068
0 votes
0 answers
90 views

I am trying to track some array changes inside of proxyfied object. For example: object = { count: 0, input: ``, tasks: [ ] } and I need to track changes of object.tasks. The problem ...
Eugene S's user avatar
0 votes
1 answer
131 views

I try to understand how i can debounce a "set" trap in javascript proxy. function debounce(func, wait, immediate = false) { let timeout = null; return function(...args) { let ...
Marc's user avatar
  • 4,049
1 vote
2 answers
146 views

Given a class like: class A {} Is it possible to modify in any way so that I can proxy when methods are subclassed like so: // proxy the `A` object in some way const handler = { get(target, ...
vixalien's user avatar
  • 390
0 votes
0 answers
74 views

Consider this code: handler.toString = function() { return Reflect.get(original,'toString'); } handler.apply = scope.exportFunctionWithName(function(target, thisArgs, args){ try { ...
MD Luffy's user avatar
  • 556
-3 votes
1 answer
374 views

I need to have methods and store bound to 'this' in my callback function, but when I use the spread operator it doesn't work. The reason for this as far as I know is that the spread operator returns a ...
EMILO's user avatar
  • 473
0 votes
1 answer
324 views

I am doing a simple app that fetches data (my tasks) from my PocketBase(BaaS like Firebase). I want to store my tasks into a ref because it could change overtime (ex: user modify the name of it). I am ...
santoro's user avatar
  • 13
0 votes
0 answers
90 views

I am working on a project where I need to monitor changes in the DOM, specifically tracking any and all JavaScript property changes that affect the DOM elements. My goal is to listen for any 'set' ...
Imperial A's user avatar
1 vote
3 answers
146 views

I have the following code where I want to invoke the instance method connect before proceeding with the invocation of every other instance method of the TelegramClient class. How can this be achieved ...
kabdik's user avatar
  • 37
0 votes
0 answers
26 views

Can someone help me explain the behavior of typescript in this example. I have no idea what is going on here. Why is childProxy1.foo not resolved while childProxy2.foo is resolved correctly? Why is ...
Micha Stubi's user avatar
1 vote
1 answer
102 views

In React we very often load data which is for some time undefined/null or some placeholder value. Now there are many ways to use loading skeletons, but in my project we have the skeletons rather low ...
Andreas Herd's user avatar
  • 1,198
0 votes
1 answer
81 views

Some interesting case which I don't understand. I proxy classes and extend a child class from a proxied base class. When a child is constructed inside the construct trap for some reason a wrong ...
Alexander Nenashev's user avatar
2 votes
2 answers
1k views

I need to exercise some code in data mapping functions. For this, I need a proxy that returns an iterable array with one element (itself; an iterable array) when any property is requested. This will ...
jcalfee314's user avatar
  • 4,930
0 votes
2 answers
71 views

I would like to find a way to get only one notification after an array sort Is there a way? Thank you const callback = function () { console.log (...arguments) } const array = [2,1] const handler = {...
tit's user avatar
  • 619
0 votes
1 answer
62 views

I'm attempting to abstract some Cypress methods into a helper object using getters. The intended behavior is that I can do something like this: todoApp.todoPage.todoApp.main.rows.row .first()....
user3534080's user avatar
  • 1,537
1 vote
3 answers
159 views

I am working on building a 2D renderer with the Javascript canvas API, and I am trying to improve performance by skipping renders when no changes to the state of any renderable objects have occurred. ...
Banshee's user avatar
  • 15
0 votes
1 answer
1k views

The following function should create a proxy object with a specific handler, but typescript is throwing a type error when I try it that way. function createProxiedObject<T extends object>(obj: T)...
Arber's user avatar
  • 571
2 votes
1 answer
4k views

I have an app in Vue 3 where I make a call to the back end of my code to get data. The data is returned nested in JSON arrays and objects, and I then assign the data to a property in my component. I ...
aCarella's user avatar
  • 2,608
-1 votes
1 answer
493 views

I am trying to create a little javascript two way form binder using proxies. I am stuck on how I can intercept 'new' calls. I use a 'construct' trap but it doesn't fire. Here is my code, I have ...
kiwichris's user avatar
  • 465
-2 votes
2 answers
535 views

I tried to proxy Function.prototype. I created a new Proxy and rewrote the toString method, however console.log('cas') doesn't work, why? Function.prototype = new Proxy(Function.prototype, { get: ...
yg lin's user avatar
  • 121
1 vote
1 answer
71 views

The set accessor does not take place whenever one does mutate the Crumbs class property value by e.g pushing into it. I'm trying to create a class property via set syntax which I expect to handle an ...
Josue Barrios's user avatar
1 vote
1 answer
469 views

I am working with JavaScript Proxy and do not understand why the target and the receiver are different in both the get() and set() traps. They appear to be the same (based on console logging). The ...
bmacnaughton's user avatar
  • 5,348
1 vote
1 answer
308 views

I'm trying to implement a lazy database connection collection in typescript. I'm creating a class called DatabaseCollection and my idea is to use a proxy to lazy load the connections (I'm using knex ...
Felipe Buccioni's user avatar
0 votes
1 answer
176 views

I have the following code: function delay(f, ms) { return new Proxy(f, { apply(target, thisArg, args) { console.log(this) console.log(thisArg) ...
Pavlo Zalutskiy's user avatar
1 vote
0 answers
375 views

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 ...
TK421's user avatar
  • 905
1 vote
1 answer
586 views

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 ...
kazon's user avatar
  • 412
0 votes
1 answer
38 views

<q-select v-model="item" :options="colect"> <q-input v-model="item.name"> const colect = ref([... ]) const item = ref({... }) The dilemma is that, when ...
Rafa Calderón's user avatar
0 votes
1 answer
60 views

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 ...
user469485's user avatar
1 vote
1 answer
1k views

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(...
tlrobinson's user avatar
  • 2,858
6 votes
3 answers
12k views

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 ...
Fabis's user avatar
  • 2,122
0 votes
0 answers
18 views

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 ...
Hunter Woodall's user avatar
1 vote
0 answers
32 views

I have the following functional logic code: const trans = {} trans['toCssClass'] = (someListing) => { // <-- someListing here is undefined console.log(someListing) someListing.a = ...
BenGee23's user avatar
0 votes
0 answers
111 views

I've written a library that relies on equality checks. Example: export class Item { constructor(opts) { if (typeof opts.name !== 'string') throw new TypeError('Name should be a string'); if (...
Adriaan Meuris's user avatar
0 votes
0 answers
229 views

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 ...
joehinkle11's user avatar

1
2 3 4 5
7