Skip to main content

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
0 votes
1 answer
29 views

Multiple Access to two-dimensional array (using setters/getter via Proxy or Object.defineProperty)

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
0 votes
1 answer
65 views

Detect direct instances in JavaScript

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,708
-1 votes
1 answer
81 views

Why is this object a Proxy only when the page field is 1?

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,783
1 vote
1 answer
60 views

JavaScript Proxy not working for opened Window object

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
  • 49.5k
0 votes
1 answer
32 views

Mocking an async builder pattern API with proxy

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
67 views

Cannot access puppeteer Proxy in my Jest test (TypeError: Cannot read private member #frameManager from an object whose class did not declare it)

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
32 views

Javscript proxy not transparent in Chrome

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
  • 2,948
0 votes
0 answers
77 views

Trap array changes (add/delete) inside object of proxy

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
81 views

Debounce "setting" of values in proxy trap without delay/timeout

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
  • 3,836
1 vote
2 answers
94 views

Can a Proxy detect that a subclass is adding methods to a class?

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
  • 370
0 votes
0 answers
50 views

How to attach toString to proxy handler

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
  • 546
-3 votes
1 answer
166 views

How can I use proxy with spread operator or object.assign?

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
  • 423
0 votes
1 answer
68 views

myRef.value is holding a Proxy even tho it should hold a simple array

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
62 views

How to globally track property changes and DOM mutations in JavaScript?

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
121 views

How to always apply a method before executing another method via a proxy?

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
  • 25

15 30 50 per page
1
2 3 4 5
21