Jump to content
⚠️ Deprecation Notice: Cloud Control API V1 – Switch to V2 ×

Recommended Posts

Posted

I have an event handler:

 

function evthandler(event)
{
    if (event.name === 'input' && (typeof (event.delta) !== 'undefined'))
    {
           console.log('event: ' + JSON.stringify(event));
           console.log('event.delta: ' + JSON.stringify(event.delta));
           let b = event.delta.state;
           console.log(b);
    }
}

When the event fires, the console.log statements are done, but the script breaks with an unnamed error (see image).

NOW ... when I change the code a bit:
 

function evthandler(event)
{
    if (event.name === 'input' && (typeof (event.delta) !== 'undefined'))
    {
           console.log('event: ' + JSON.stringify(event));
           console.log('event.delta: ' + JSON.stringify(event.delta));
           let d = event.delta;
           let b = d.state;
           console.log(b);
    }
}

This code does NOT break!

If I try something like:

 

let a = JSON.parse('{ "foo" : "bar", "baz" : { "k" : 42 }}');
console.log(a.baz.k);

Then this code also works without problem.

So could anybody please explain what is so "special" about the event object and where this behavior is documented?
 

error3.jpg

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...