« first day (4505 days earlier)      last day (668 days later) » 

01:22
Can you not destructure using nested properties?
I have this code:
{object.left}
That returns 10
but if I try to destructure to an object it fails
 var b = {object.left}
  SyntaxError SyntaxError: Unexpected token '.'
Or am I using descrtructing incorrectly?
02:00
@1.21gigawatts this is not an object, it is a code block with a property accessor left called on an object object
you can't assign block statements
at this point, your code is interpreted as "assign an object literal with a <syntax error> to a variable named b"
besides, at least in JS, destructuring means unpacking something, not the other way around
{
    const obj = {
        a: {
            b: {
                c: 42
            }
        }
    }

    const { a: { b: { c } } } = obj

    c
}
^ this is how you would destructure a nested property - by basically mirroring the structure of the object
yeah, if you want to return something from a block statement, you'll need to use an outer scope variable
as they basically exist to control scoping
let a;
{
    a = 42
}
console.log(a)
so destructoring has to be on the left hand side of the assignment operator
i have an object with one property I don't want included
i have object with primitives but one is a reference and i want that one not copied
@1.21gigawatts yup, because it's basically a normal assignment with a bit of magic under the hood to call accessors and assign to individual variables
var theObject = {left: 0, top: 0, file: fileReference }
var desiredObject = Object.excludeProperties(theObject, "file");
That's what I was hoping existed but the answers say there is not native methods to do that
02:11
@1.21gigawatts you can use a rest property if you don't mind discarding a variable:
{
    const obj = { a: 1, b: 2, c:3 }
    const { a, ...rest } = obj
    rest // {b: 2, c: 3}
}
uh wait
so an object name rest is created?
unrelated idea
put a console on the right side of the page XD
the name doesn't matter - can be anything
so we can type in javascript
it just "packs" all the "rest" properties apart from those explicitly destructured in an object (same thing works for array destructuring)
@1.21gigawatts called devtools? :)
yeah i have it open now
:)
i forget sometimes
could you invert it?
only include specific properties?
if {...nameOfNewObject, propertyToInclude, propertyToInclude2} = sourceObject // results in including "propertyToInclude", propertyToInclude2 and excluding all other properties on sourceObject
*typo
would this {...nameOfNewObject, propertyToInclude, propertyToInclude2} = sourceObject // results in including "propertyToInclude", propertyToInclude2 and excluding all other properties on sourceObject?
nope, that won't work
Uncaught SyntaxError: Rest element must be last element
:(
unfortunately, you'll have to do the repacking manually
{
    const obj = { a: 1, b: 2, c:3 }
    const { a, b, ...rest } = obj
    const newobj = { a, b }
    newobj
}
 
5 hours later…
07:06
hello
Any one online
 
5 hours later…
11:39
that's not a useful question
 
1 hour later…
12:50
Does anyone in here have any experience with sharedWorkers?
I have a minimal working example of a sharedWorker, it is acting weird:

https://stackoverflow.com/questions/75453312/why-does-the-ports-array-of-this-sharedworker-mwe-increase-despite-no-additional
 
2 hours later…
14:59
Nvm, solved it
15:34
posted on February 15, 2023 by Ben Mason

Hi everyone! We've just released Chrome Dev 112 (112.0.5594.1) for Android. It's now available on Google Play. You can see a partial list of the changes in the Git log. For details on new features, check out the Chromium blog, and for details on web platform updates, check here. If you find a new issue, please let us know by filing a bug. Krishna Govind Google Chrome

16:02
16:20
@SebastianNielsen what was the problem?
It was very trivial.
Pressing the button would cause the component to rerender, which would retrigger this line of code:`new SharedWorker(
new URL('./sharedWorker.js', import.meta.url)
);`. Retriggering that line of code would trigger the `onconnect` inside of sharedWorker.
I just had to move it outside of the component, so that it only got called once.
 
3 hours later…
19:32
> Serverless scales well, but most databases don’t (SPONSORED BY MONGODB)
lol
> Wheels are great for cars, but most cars don't have them
 
2 hours later…
21:35
Is it possible to have a click-on-image link to a button, which in turn is linked to a modal?
I need to trigger my modal, which is triggered by something like this:
<button data-toggle="premium-modal" data-target="#premium-modal-8966f42" type="button" class="premium-modal-trigger-btn premium-btn-lg">
												<span>Premium Addons</span>
											</button>
but I can only use an image <img> tag to do so

« first day (4505 days earlier)      last day (668 days later) »