question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Object methods to access to chart.options as proxy

See original GitHub issue

After the PR which changes the chart.options to a proxy, the usage of Object methods (like getOwnPropertyDescriptor or hasOwnProperty) are reporting only if the property are stored on top level.

Before the PR, the options, being built by merging the other options, the Object methods worked well.

I don’t know if there is any possibility in order that proxy handler could work as before using the above methods, therefore going in cascade on the objects of different scopes.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:29 (29 by maintainers)

github_iconTop GitHub Comments

2reactions
kurklecommented, Feb 18, 2021

I guess you can’t use the in operator either.

Do you use any javascript side helpers with the JSINTEROP? You could create a javascript helpers for interacting with the options.

For example:

function setOptionValue(target, name, value) {
  target[name] = value;
}

function getOptionValue(target, name) {
    return target[name];
}

function hasOption(target, name) {
  return name in target;
}

(I’m not sure if this is something you can do though 😄)

1reaction
stockiNailcommented, Feb 22, 2021

Tested right now, nothing changed.

function has(obj, key) {
    // debug fr a specific key 
    if (key  === 'max') {
       	console.log(obj[key] != undefined); // returns true
       	console.log(key in obj); // returns false
       	console.log(Reflect.has(obj, key)); // returns false
     } 
     return key in obj;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Proxy - JavaScript - MDN Web Docs
The Proxy object enables you to create a proxy for another object, which can intercept and redefine fundamental operations for that object.
Read more >
How to use javascript proxy for nested objects - Stack Overflow
The isProxy property in the getter is used to detect whether the currently accessed object is a proxy or not.
Read more >
Proxy and Reflect - The Modern JavaScript Tutorial
A Proxy object wraps another object and intercepts operations, like reading/writing properties and others, optionally handling them on its ...
Read more >
Ext.data.proxy.Proxy | Ext JS 6.2.0 - Sencha Documentation
Matches options property names within a listeners specification object - property names which are never used as event names. Defaults to:
Read more >
Configure charts using globals - GitLab Docs
API version to use in the CronJob object definitions. Configure Ingress settings. The GitLab global host settings for Ingress are located under the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found