« first day (4029 days earlier)      last day (910 days later) » 

1:56 AM
Hi everyone! I'm trying to sort the following array using js built in sort function with localeCompare. As you can see each elements in the array represent an item name and their size (eg 6", 6.5").

If the sizes are in decimal, the sort doesn't work as expected. Any suggestion is appreciated

const arr = [

'CAKE BOARD ROUND 6" (GOLD) +/-100PC/REAM ',

'CAKE BOARD ROUND 6.5" (GOLD) +/-100PC/REAM ',

'CAKE BOARD ROUND 7" (GOLD) +/-100PC/REAM',

'CAKE BOARD ROUND 7.5" (GOLD) +/-100PCS/REAM',

'CAKE BOARD ROUND 8" (GOLD) +/-100PC/REAM',
 
 
4 hours later…
6:24 AM
@KevinB The point of the exercise is not to use required. How do I collect the result of all the $$ calls. I was under the impression that when one of them returns falls the myFunction will also return false and not run anymore. But that is not the case as all of them are fired at once. How to collect return?
 
6:45 AM
Store the results in an array of sorts, then if the array contains false, you return false. If it doesn’t, you return true. If you want it to return at the first failure, then you’ll need to check the return between each call.
 
 
2 hours later…
8:30 AM
Oh look it's Craig :D
 
Allegedly
 
:O
Also it's fully we're still all room owners
 
8:58 AM
So so good
 
 
1 hour later…
10:17 AM
There is no way to allow styling of web components by adding classes to their container is there?
    my-component.activated button {
        background: #adf;
    }

<my-component class="acitvated">
    <stuff></stuff>
</my-component>
(with stuff not being part of the shadow dom that should be restyled, that is just exemplatory filler)
 
10:51 AM
hmm anyone knows how to make a knex transaction "lock in exclusive mode"
ie to not allow further changes to a table until the transaction has finished?
 
@salbeira the way is to pass CSS variables to it usually
 
To add to above: from within a function that has been given a transaction object (thus not 'seeing' the global knex connection instance).
db = knexBuilder(....) //make a connection
db.transaction(trx => {
    const changes = await doChanges(data, trx);
    //should lock the db as well inside the doChanges function
    await doLogging(changes, trx);
});
meh notices I forgot await and async :P
 
11:20 AM
This should be the behaviour
Or at least I was when we discussed it around ±2014 when knex added the disposer pattern transaction API - I don't remember the specifics too well
 
Hello, Is there any function in pure JavaScript to get nearest element (say input)
 
@Rana Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
11:40 AM
like when I click on a button than focus on its nearest input . While this can be easily solved by giving class or id but I want this because there are many inputs and buttons.
 
@BenjaminGruenbaum The issue is that I do not want or can provide every attribute the "customer" of my web component wants to modify. Isn't the idea of web components to provide a way to reuse functionality of custom ui elements?
 
@BenjaminGruenbaum what do you mean with "this"?
typescript complains that "trx.raw()" does not exist.
 
11:56 AM
As far as my research told me it seems simply not using web components would be the way to go if I would want to let people customize the looks of the component and just use custom ui elements without shadow dom
 
12:15 PM
@Rana actual positioning (and thus getting distances) is hard, really hard.
So there's no direct function and you'll have to rely on iterating the full dom and getting the position/size of each element (very slow).
 
12:27 PM
In Typescript, how do I define a type that is basically "can have any string:any members, but MUST have "fluidSource:true""?
because if I just do the latter, any other properties get flagged as errors that "do not exist on type"
 
@paul23 , thanks for reply . But I only need to focus input when a button is clicked the body is somewhat like this :
<div class="reed"><div><input></div><div></div><button></button></div>
I need to focus input when button is clicked . So need to know any method of selecting nearest element in pure JavaScript (as there is method in jQuery , i.e , closest) . One solution can be playing around with next sibling or previous
 
@Hypergardens that's how typing works: if you define an option as "potentially having xyz, and always abc" you can "eat" anything containing abc or abc + xyz. But once you use the provided object you can only access abc.
 
Yeah, but I don't get how to declare it. Basically I want to declare JSON-able objects as game entities, and in different parts of my code to ensure and imply they have certain members
 
@Rana a better solution is to use ids and calculate the "correct" id from the button (in generic case using string manipulation, getting its own id and then calculating the would be label id)
 
12:50 PM
@Hypergardens interface MyInterface { fluidSource:true; [key: string]: any }
 
Thank you!
@VLAZ should I use types or interfaces for this use case?
I'm not sure what the difference really is
 
I don't think it matters, to be honest.
 
I'm reading about it but it's not clicking for me
 
You can also do type MyInterface = { fluidSource:true; [key: string]: any } and it's going to work the same.
 
So would this be how I "create" a type?
export type Entity = {
    id: number;
    [key: string]: any;
};

export type fluidSource = {
    fluidSource: string;
} & Entity;
 
12:55 PM
If you want to have it as an intersection - yes. If you had interface instead of type there then the second one would be equivalent to interface fluidSource extends Entity { fluidSource: string; }
 
@VLAZ don't use any there, though as it then allows both getting and setting it.
always use unknown instead of any
 
@salbeira right, but you realize this is also the case for a video tag or an img tag right? They only customize "from the outside" or custom properties. Are you looking for theming?
 
In this case, the two are basically the same. type allows you to do some type arithmetic you cannot with interface like unions. But usually interface works just as well.
 
@Hypergardens Never do that - never have a type that both has an index signature and additional properties
 
@BenjaminGruenbaum Well not theming more a "OK I have here e.g. a custom button thing and I just want the person from outside to define a border radius on the whole component if they want to."
 
12:58 PM
@BenjaminGruenbaum Is that really a problem? I have loads of those
 
@salbeira they can wrap it in a div and give that border radius
 
@paul23 That's what unknown also allows. But it's more type-safe, as it forces doing the check on retrieval - it's not assignable to anything. I agree it's preferable, I was just a bit lazy here.
 
@BenjaminGruenbaum an index signature?
 
@paul23 it's not a problem as in it's rather slow and confusing and it makes TypeScript kind of meaningless
 
the border radius is just an example
I do not know if stuff like text, background color, box shadows etc. would work the same
 
12:59 PM
@Hypergardens When you have a type with [key: string]: any that's called an index signature
 
To define "dictionary types but this subtype needs to have at least keys x, y, z"
 
That's what I'm looking for, yeah ^
 
@salbeira If you don't want isolated CSS don't use shadow dom, the whole point of shadow dom in web components is to avoid collisions.
 
Used often to refine the type explicitly after I already checked for key existence in code.
 
Entities are dictionaries that can have all sorts of properties, but always have a parent attribute, always an id, and for example enemies always have .health and .ai
 
1:00 PM
@paul23 I understand, and the list of options themselves is dynamic?
@Hypergardens then have the type contain just parent and id, and have the enemies have that and health and ai?
 
but an entity can be multiple things, by composition... it can be a fluidContainer, an enemy, etc simultaneously
 
@BenjaminGruenbaum Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. See the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
yes (see the other message) it typically happens when the keys need to be changed (or inserted/upserts) and I need for follow up code refer to this new inserted value
 
Ah shit I forgot code highlighting in chat doesn't do ``` but only spaces
 
1 message moved to Trash can
 
1:02 PM
my code has systems and checks that filter Entities by their properties, as well as other checks on them
 
I am this close to kicking the bot.
 
:P
 
@Hypergardens Yes, but that shouldn't be part of the interface
 
I'm doing a sort of ECS system, if that rings any bells, and I want the objects to be checked for the right properties in order to help me write code for them and to keep bugs from creeping in
 
Also sometimes lazyness: in react you often use the construct "eat all properties you understand and pass remaining to child object".
 
1:03 PM
perhaps constraining JSON-loaded objects to the components as well
 
I don't understand, the type Entity represents properties on every entity, right?
If every entity can contain every property - you can just pass any or an object with an index signature.
 
then a natural idea is to have a property object that defines all keys it understands, and a "remaining" part..
 
You can get type feedback with index signature (by using generics) but honestly - don't.
 
Where I know the values of remaining part are always string or numeric (no functions or complex data)
 
@paul23 yeah, don't do that - that totally breaks the point of typing - you might as well just write in regular JavaScript.
 
1:04 PM
@BenjaminGruenbaum it's how react/UI libraries work :P
 
@paul23 So have a .metadata property that is a dictionary of additional properties or just don't encompass them in the type.
@paul23 it's really not, in React (well, in its types) every component has a generic on the props not an any or a dictionary.
 
This is the kind of thing I want:
let jug = {
    id: 1,
    parent: 0,
    baseName: "jug",
    fluidContainer: true,
};

let goblin = {
    id: 2,
    parent: 0,
    baseName: "goblin",
    health: 5,
};

let goblinJug = {
    id: 3,
    parent: 0,
    baseName: "goblinJug",
    health: 6,
    fluidContainer: true,
}
 
Well that wouldn't be "When in rome do as the romans do". - IE materialui uses this to pass properties to the underlying input when using TextField.
Same for semantic ui
 
If you're a library and you need to drill props to children I would still not do it but I understand why they'd encompass it on the type so you wouldn't expect type safety
@Hypergardens what's stopping you?
 
The thing is I want the styles directly to be separated (aka. a "my-button" should not be styled by a "button" css but I want someone to be able to just style "my-button" directly
 
1:07 PM
interface Entity {
  id: number;
  parent: number;
}
 
@BenjaminGruenbaum Nothing is stopping me, but I want to control for those types with explicit coding so that writing functionality in other files builds on it
 
button {
    color: red;
}

my-button {
    color: blue;
}
 
@BenjaminGruenbaum Material ui "fixed" it by explicitly defining all input properties in their types file. However that's not how it actually works - if in the future (say) input accepts on some browser more properties, material ui directly handles that - but the type definition does not.
 
I tend to forget what members a thing had when I haven't created that object lately, I want it to be visible and constrained by interfaces
 
@paul23 the type definition can just read lib.dom.d.ts and use those types?
 
1:08 PM
@Hypergardens you can just combine interfaces?
 
@Hypergardens yes, that's good - that's the opposite of having an index type signature.
 
so that in a function "handleGoblinJugs" I can have explicit checks for "is Goblin and Jug"
Sorry for being so unclear, I'm new to typescript and kinda anxious about my architecture
ok, -very- anxious about where the project is going, and I want a good foundation for it
 
Basically :
interface Entity {
    id: number;
    parent: number;
}
let jug = {
    id: 1,
    parent: 0,
    baseName: "jug",
    fluidContainer: true,
};

let goblin = {
    id: 2,
    parent: 0,
    baseName: "goblin",
    health: 5,
};

let goblinJug = {
    id: 3,
    parent: 0,
    baseName: "goblinJug",
    health: 6,
    fluidContainer: true,
}

function doSomethingOnEntity(e: Entity) {
    console.log(e.id);
}

// TypeScript is structurally typed - so all these pass as entity
doSomethingOnEntity(jug);
 
the problem arises for me in the doSomethingOnEntity, like increasing .health
 
I think the key thing you're missing is that TypeScript is structurally typed
Not all entities have .health so doing it inside doSomethingOnEntity is a design error
 
1:11 PM
function doSomethingOnMultipleInterfaces(e: Entity & IsFluidContainer) {}
that's if you want to check if it has multiple interfaces
 
It will work, typescript has guards, you can make it work but don't.
@paul23 prefer creating a new interface that extends both of them to using intersection types here since it's (usually significantly) faster to compile in TS
But that works
 
aaah okay, so what I'm wondering is how do I assert that inside the function?
 
Meh often you need those things "in place" and adding all extra interface types is kind of hard
 
function doSomethingById(eID) {
    //assert that game.findById(eID) is Goblin and Jug
}
 
hard as in: makes the list of interfaces difficult to comprehend/find inside.
In realistic codebases I find "finding resources/definitions" actually the most difficult thing to do. Not the code itself or how things work, but actually going through the files and finding where code is located is something I kind of often lose myself in.
 
1:15 PM
so I want to do something like
let entity = <Entity&Enemy&FluidContainer>game.findById(eID);
and then I can see the properties it'd have
Is my case a bit clearer now?
 
huh you want to filter an existing list? Filtering need to be done manually
 
I want to define a structure for JSON-able or JSON-loaded data somewhere, then have the properties be checked and autocompleted in various other files as I code without missing properties
 
no, I have the ID of an entity, let's say 534. That's the argument passed in the function.
 
@paul23 if you don't care about build tiems it's not a big deal
 
1:18 PM
Inside the function I want to specifically make sure it's an intersection of types (e.g. it has certain sets of members in certain arrangements)
 
Actually I hate no type system ever allows for filtering of elements with Array.filter
 
@Hypergardens that's the opposite of what you want though that's a cast, casts tell the compiler "please override any checks you have"
@paul23 huh?
@Hypergardens yes, you can do that with narrowing and type guards. Read about those :)
 
say I have an array: gottenValues: Array<Entity|void> //void is due to how map works.
and then I do something like:
const filtered = gottenValues.filtered(a => !!a) //should get all undefined out of it
//later:
for (const f of filtered) {
    f.data; //errors all over here!
}
 
Well the thing is, the entities are already filtered and I'm calling a function by ID on them
Crap, I think I'm not being clear
 
I often go unsafe and directly cast the filtered in above case to Array<Entity>
 
1:22 PM
@Hypergardens You are being clear, but you were given the answer and now it's time for you to read the 2 manual references I've sent you that explain this very clearly.
 
Not that unsafe as it's all contained inside a single (native js) line
So anyone can see directly it should work in all cases provided without tests.
 
@paul23 Ah yes, there was a discussion about it somewhere
 
/// game logic that figures out the IDs [2, 3], for each call this function:

function doSomethingToEnemy(id: number) {
    let enemy: Enemy = game.getEntityById(id);
    enemy.hp += 1;
}
 
@MeenuKs Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
1:23 PM
@paul23 Is this code supports all browsers to hide password default eye icon :
 input::-ms-reveal,
      input::-ms-clear {
        display: none;
      }
 
@Rana Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. See the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
can any one help me sort data by date codesandbox.io/s/pensive-kare-3qdmg?file=/src/App.js
 
@paul23 fwiw you can specify a type guard manually but I agree it's annoying type guards aren't more flexible. I've found some discussion around it but unfortunately it's Microsoft internal and I have no idea if I'm allowed to share it - I'll see if there is something in the repo.
 
@paul23 because at last of this answer stackoverflow.com/a/61450596/16846346 . It says : This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
 
@BenjaminGruenbaum haha no worries a discussion won't really help here, since it either is fully supported or the "easiest" case is to just sidestep type safety.
 
1:26 PM
@paul23 the easiest solution is to add a type guard which I agree is kinda lame
 
@BenjaminGruenbaum I'm reading it, but I was looking for a way to do this more... elegantly?
 
fml
As in:
const arr = [1,2,3,4,undefined,6,7,undefined];

const results = arr.filter((x): x is number => Boolean(x));
It's like, no one worked on this chat since I was last active like 4 years ago
 
As I said: as long as the type guarding/unsafe calling is contained inside a single statement (without nested functions) it's "fine"
 
like
let enemy = (definitely an Enemy) game.getEntityById(functionArg)
 
@Hypergardens read. the. docs. I've. sent.
@paul23 it's really not and it should be inferred at least for obvious cases. I can totally see overloads for casting primitive constructors and obvious functions useful.
 
1:29 PM
And i don't think I've ever seen a type system in any language that can deduce such things inside data structures.
 
It's much harder in filter than in map obviously because in map you can just look at the return type of the mapper and in filter it's always boolean and you need (from TS's point of view) to "export" type assertions (the opposite of narrowing I guess?) you'd also want a more "generic" solution that will not work only for the built in filter.
 
Fair point, but the "Filter against null/void" is so common place in our codebase :P
 
I have 2 pieces of code:
 
often the result of "parallel" map look ups.. Or results from Promise.all where undefined means "nothing return".
 
let generatedHTML = "";
results.map(result => {
    generatedHTML +=
    `
      Some HTML
    `
})
and
 
1:31 PM
You need to say "in cases the return of the filter function is under a type guard and I can prove it's true, apply that type guard to the element value of the filter" but that only works because you know it's Array.prototype.filter, what you really need is a way to express "apply type guards from this callback function to my return type or some value". It's tricky.
 
let generatedHTML = "";
results.forEach(result => {
    generatedHTML +=
    `
      Some HTML
    `
})
Which one should I use? I'm thinking that I should use forEach, as I do not need to have anything returned, but at the same time, I've read that map is faster.
 
@paul23 yeah solving it ad-hoc in the filter index signature is super easy. Especially if you support just filter(Boolean)
@AnnZen You should not use map with side effects, map isn't faster than forEach (it's actually a bit slower because it creates a new array) not that it matters since performance in your case is dominated by whatever you're doing with that HTML
I'd do results.map(result => '\nsomeHtml\n).join('');` probably? It really depends
 
Well this is kind of specific right now, especially since our codebase is like 50/50 flowjs/typescript :P
 
@paul23 It's not a new use case
 
I mean specific how to solve it to typescript
From our perspective being in the middle of the transition from flow to typescript.
 
1:34 PM
Wait, flow solves it?
I didn't know, how does it work there?
 
no, no :P
 
Just that in flow the type guards would work completely different, so code would look quite alien.
 
tbh the TypeScript syntax for conditional types and inference is awful
 
@BenjaminGruenbaum Thanks! What do you think about this quote? "So which one is faster? There seems to be a very small difference between forEach() and map() with respect to speed. map() is faster, but these are so miniscule that it shouldn’t affect your application’s performance significantly. You can almost always use map() and other array methods like filter() and reduce() instead of using forEach()."
 
1:35 PM
%checks is kinda bad (if I remember my flow) but I still have PTSD from huge ternary chains in TS
 
Weirdest thing is that typescript doesn't use unknown a lot, and I have to transform flows mixed (anything in, nothing out) often to void in typescript and then sometimes change code even.
 
@AnnZen It's absolutely incorrect - both because who cares about performance in these cases if you need performance you likely want neither and in your code your performance will be dominated by the html you're joining and because it just isn't true.
 
I mean if I don't care what the result of a function is, (ie native onchange event) it should accept any function, independent of that function's return value.
yet the definitions often state the function needs to have void return value - meaning code has to change.
 
I'm happy to link to the Torque (kinda like C++) in V8 that will show their compilation path @AnnZen but I think that would just be confusing if you haven't read compiler code before? I think it's better not to focus on micro-benchmark and "which is faster" question - instead focus on algorithms and ideas
 
Is optional chaining operator( ?.) a short-circuit operator?
 
1:39 PM
@paul23 I think people underuse any and overuse complex types. I'd rather have a code that uses any often than code that does F-bounded polymorphism for the kicks.
@DamodaraSahu that sounds like something you can test fairly easily in your console?
 
@BenjaminGruenbaum Thanks! I've read compiler code before, so I'd be happy to have the link.
 
Also, how would it work without short circuiting?
 
@BenjaminGruenbaum That a question to me?
 
no to Damodara
 
Feels like a trick question on an interview. I wouldn't consider it "short circuiting" because the actual idea is to do something similar to short circuiting. While when talking about short circuiting you often mean a "side effect" of a function you have to take into account while programming.
 
1:45 PM
V8 has several layers, the one I'm sending over is _after_ the code was initialized and ran through the interpreter - it was "hot" and is now being optimized - there is a lot of further information in v8.dev (and somewhat in mrale.ph though the stuff there is pretty old).

This is map in that phase: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/compiler/js-call-reducer.cc;drc=5539ecff898c79b0771340051d62bf81649e448d;l=1539?q=ArrayPrototypeMap

I warmly recommend building V8 (either yourself or just checkout the Node.js repo we have very clear building instructions and if y
@paul23 what if the properties are getters?
Or it's a proxy?
But generally premature optimization is the root of all evil in 97% of cases @AnnZen
BTW is this you @AnnZen youtube.com/channel/UCplcsIsZR4q0jR3UgXjoSDQ if so you look tough :D
 
@BenjaminGruenbaum Okay, got it :) Thanks for everything!
 
cool yt channel, cheers :)
 
@BenjaminGruenbaum ^^
 
2:02 PM
@BenjaminGruenbaum Ok, after all the reading and a bit of testing, having explicit properties for every component in a large Interface might be the way to go for me. I think I was looking at the problem backwards to an extent. I need a well-defined Entity type more than the checks in each function.
 
You do :)
 
I do not guarantee that I won't return with stupid questions, but I'm grateful so far
 
2:22 PM
There is no way to explicitly pass style from a web component container to specific parts of its shadow dom is there?
Like if I write
my-button {
    background: red;
}
that I can somehow explicitly say with js or something "this attribute will pe propagated to this thing"
aka if background of my-button is defined that this manipulates the internal style of the button element inside the shadow dom
something like "my-button.style.background changes my-button .internal-class.style.background" or something
 
@Hypergardens I mean, I've learned most of my coding by asking stupid questions so really no harm done - but I might not be available here I'm pretty rarely here these days
 
One of the issues is the particular architecture of my game... if I passed entities as parameters it'd be all good, but I need to pass IDs which if I understand correctly would force me to add manual type-guards to everything later in the function
 
user16940297
2:41 PM
Kevin, I have a quick question.
 
user16940297
Should it be: manageUi or manageUI?

Following the toUpperCase() method.

Should it be: manageUi or manageUI?
 
If I understand it correctly, LOCK table IN SHARE MODE doesn't lock against extra inserts or updates of other rows right? (In postgresql
I need mode EXCLUSIVE for that right?
 
@htmlcssjava3456 manageUI because UI is an abbreviation of user interface probably
 
Aren't there methods in the standard js for document dom that have stuff like Html ?
Camel cased abbreviations
 
user16940297
Following the camelCase method.

Should it be: manageUi or manageUI?
 
user16940297
2:53 PM
Should it be: coverUiPlayerFacade or coverUIPlayerFacade
 
user16940297
where abbreviations are involved
 
If it's 3 characters or less then it should be capitalized but if it's more then not
like XMLHttpRequest (both XML and HTTP are abbreviations)
 
user16940297
This would be right? coverUIPlayerFacade
 
Would that not be more a fold than a map?
where your fold just ignores the accumulator
a different web component related question: Slots
Is there a way to have multiple custom elements that are related to each other where one of them has a hidden or implicit slot assignment?
 
@paul23 Never heard of short-circuiting as a "side-effect". Especially not of a function. It's a specific evaluation optimisation: false && x can never result in true, thus it short-circuits into resolving into false immediately. The opposite of that would be to read the value of x and then perform the evaluation of the expression and thus determine what boolean value it resolves to.
 
e.g. <my-container> has a slot for items and <my-item> has an implicit <my-item slot="items"> but that does not need to be specified because <my-item> should never be used outside of <my-container> ?
 
@salbeira It's valid to fold into one value and ignore the accumulator. It's probably not the best but you can do that to get the last value: arr.reduce((_, x) => x)
Should still probably be avoided but it's a different case to mapping without mapping.
@htmlcssjava3456 This personally annoys me a lot. Technically, both are valid. Depends on which way you want to go for it. The correct spelling is "UI", of course, however, that's not valid camelcasing because each word starts with a capital letter there. So, strictly camel-cased name would use "Ui". But I find it more practical to call these with their actual thing. So, if it is up to me I'd go with "UI", "URL", "OK", etc.
But at work we have this setup with automatic checkers and you have to override them, so it's often easier to conform.
 
3:39 PM
From the main thread, is it possible to access data stored at blob urls that were created in a worker thread?
 
@salbeira Never reduce without an accumulator - that's like saying "I'm reducing with side effects and I'm going to confuse a future reader" :D
 
Stop stop stop I did not ask that question
 
@libby what does the file API specification say? It it transferable or not?
@salbeira I wasn't aware being asked a question was a requirement for replying in conversations here :D?
 
Its fine I just got agitated by the ping thinking I get an answer to my actual question xD
 
What was your actual question?
@salbeira that?
 
3:48 PM
yes
 
Also, by implicit slot assignment do you mean one component assigns another's slots or do you mean you want to enforce it in terms of type safety?
 
I didnt even see that VLAZ's message contained a link to an already answered question and just rhetorically responded to what first came to mind thinking about confusing maps
 
@BenjaminGruenbaum it looks like File is serializable... but I'm wondering more about how the URL.createObjectURL works
 
(And you're familiar with implicit slot names just to be sure)
 
I guess specifically if this is transferrable across threads
 
3:50 PM
@libby I'd recommend you check our implementation in Node.js - "Transferable" in Web APIs is lingo for transferable across threads.
 
Yes ... let me phrase my question in a longer way
Shadow DOM:
 
@libby do you want shared memory access (multiple threads working on the data) or do you want the main thread to "hand off" the blob to another thread?
 
<div class="stuff">
    <slot name="stuffing">Empty</slot>
</div>
 
The latter
 
Light DOM:
 
3:51 PM
@BenjaminGruenbaum main thread hands off to another thread, but then the other thread passes back the blob url to the main thread once it's done
 
<my-container>
    <my-item>First</my-item>
    <my-item>Second</my-item>
</my-container>
I want the my-items to have an implicit <my-item slot="stuffing">
 
@BenjaminGruenbaum I'm not sure if this even possible – my apologies, I sort of dove into this for the first time yesterday.
 
I do not want the "user" of my web component to know that INTERNALLY there is a slot called stuffing
I jsut want them to write my-items
<my-article>
    <my-references><a href="example.org">Good Stuff</a></my-references>
    <my-content>Bla Bla Bla, Magic!</my-content>
    <my-title>Tales of Arise Review</my-title>
</my-article>
 
When I tried to pass the blob back, I couldn't fetch it in console
But the blob I created from the main thread was perfectly accessible
 
With slots the order of the items there would be completely irrelevant and each of the my-reference, my-content and my-title would just be assigned the correct slot and be ordered correctly
But I do not want the writer to have to know the NAMES of the slots each element is assigned to
Right now it would need to have something like
<my-article>
    <my-references slot="rfrncs"><a href="example.org">Good Stuff</a></my-references>
    <my-content slot="cntnt">Bla Bla Bla, Magic!</my-content>
    <my-title slot="ttl">Tales of Arise Review</my-title>
</my-article>
 
3:56 PM
@salbeira Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. See the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
however evil I would name my slots the user of the component would need to know the names
to assign them correctly
I would just love to be able to say "just put that into a <my-content> element and it gets placed where you would expect it to"
 
@libby look at how to transfer objects from one thread to another, how would you transfer a URL or an ArrayBuffer?
 
So a URL you can just pass the string
But then the contents at that url are not transferred
 
@salbeira I'm actually... not sure - I vaguely recall a proposal but I have no idea if that got in.
@libby I meant a URL object not a url string
Let me check if I can find it in the repo (github.com/WICG/webcomponents )
You can also ask there :)
 
@BenjaminGruenbaum I'm not sure how to transfer the URL object, that's why I came here :)
 
4:09 PM
this youtuber is so trash
his explanation of CORS is so surface level, doesn't explain why it's there, and gives a shitty explanation how to solve it and doesn't explain the security implications of doing so
 
just install the chrome extension, easy
 
> 206,970 views
God help those 200k people
 
CORS is such a stupid simple process, with such an absurd amount of misinformation surrounding it
Everyone wants a simple copy paste solution rather than understanding the problem
 
@VLAZ well if you look semantically it should always evaluate, especially since it's just a truth table parser
Coming from electrical engineering it's even rare to see short circuits.
 
YOu could probably burn through all of your downvotes on answers in the cors tag daily
 
4:13 PM
MDN's article I think is pretty good developer.mozilla.org/en-US/docs/Web/HTTP/CORS but as most MDN articles are, it's long.
 
@BenjaminGruenbaum have you done this before?
 
@libby I have worked on some of those standards before and the code to do this in Node so yes :)
 
Is there any way you can point me in a concrete direction? I've never used ArrayBuffers before
 
I just have a memory from this room from a good time when the culture was "teach people how to fish" rather then helping them directly. To be fair I have no idea how to solve salbeira issues which is worse because I've dealt with it before and forgot what was the conclusion :D
@libby sure I'm not being a troll on purpose, guiding someone towards a solution isn't the same thing as being mean :D See developer.mozilla.org/en-US/docs/Glossary/Transferable_objects
 
A hospital doesn't teach sick people how to make medication. I'm a sick person. I need life-support.
 
4:20 PM
Note that something being serializable (copyable) or transferable (movable) doesn't mean that browsers actually implement it.
@libby I'm not a hospital :) I don't work for you nor do I get paid to help you, I'm volunteering my time answering your question which gives me the ability to make that sort of call. You are very welcome to pay a consultant (I'm happy to recommend some) who will help you with writing this code.
 
@BenjaminGruenbaum yes if you have consultants, that would be great
I would pay for help at this point
 
@JBis You mean, God help whoever the users are of those 200k people's products...
 
@libby sure, ping me my email benjamingr @ gmail, be specific about what you need help with and I'll happily refer you to very qualified friends
(I am fairly confident that MDN page can answer a bunch of your questions though - but paying for help is a often good buff)
 
4:42 PM
@BenjaminGruenbaum to be honest, this is one issue is just a tiny one.
My bigger issue is about properly setting up a backend, but I'll include that in the email
 
5:01 PM
Sure
 
5:31 PM
posted on October 27, 2021 by Harry Souders

Hi, everyone! We've released Chrome Beta 96 (96.0.4664.27) for iOS: it'll become available on App Store in next few days. You can see a partial list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Harry Souders Google Chrome

 
 
2 hours later…
7:25 PM
posted on October 27, 2021 by Prudhvikumar Bommana

 The Beta channel has been updated to 96.0.4664.27 for Windows, Mac and Linux. A full list of changes in this build is available in the log. Interested in switching release channels? Find out how here. If you find a new issues, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvikumar Bommana G

 
7:50 PM
The amount of distress questions this stupid cause me is unreasonable stackoverflow.com/questions/69744568/…
 
8:12 PM
@KevinB If only there was any resources online that would explain how promises behave... Alas, we live in a world devoid of this knowledge. We're all expected to just guess the behaviour without anything to guide is what the real thing is /s
 
i want to hammer it into the ground
but it's at a level of stupid so high that there literally isn't a question like it on SO
 
TBH, there are dozens.
 
about the misconception maybe
the reason they thought resolve did something something special
 
It's just...is it really worth mucking through all of those questions on promises to find the best ones?
Honestly, a lot of it is covered by What is the correct terminology for javascript promises.
Even though it's asking about terminology only.
If you really want to look for dupes, take that question, from it go to the linked questions, then check each. Some might be closed as multi-dupes with that one as one. Others might have comments linking to other questions on promises. It's probably easier to find more higher quality dupe targets. I personally don't care about it right now. It's almost time for bed anyway and I don't want to spoil that by raking through the mud for half-decent dupes.
And you'd need several for your Q.
 
9:09 PM
This is kind of the fundamental issue with a lot of SO content though - some people simple do not learn the way SO expects them to. For some learners, the best way is to ask their specific question and get specific help. Is posting an actual question on SO the right way to do that? Probably not. Does that mean the person is stupid? Definitely not.
 
right
to be clear i wasn't trying to judge the asker... though i admit it's kinda hard for it to not be interpreted that way
 
Frustration is frustration and it makes it hard to express oneself correctly
 
it's a specific kind of question, where you make an assumption about something and then ask about the assumption.. rather than the root.
it's a variation of x/y
 
Yep, but that's how a lot of people learn
I think the mistake is thinking that all SO questions should be some canonical source of truth
Which is true for some questions and some answers
But really that person wanted a chat room and some one on one learning
 
it's a good way to learn, because it forces you to question your assumptions. but it doesn't lead to creating a good Q/A pair
 
9:13 PM
posted on October 27, 2021 by Daniel Gagnon

The Beta channel is being updated to 96.0.4664.25 (Platform version: 14268.18.0) for most Chrome OS devices. If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 vertical dots in the upper right corner of the brow

 
The tech industry often makes two massive assumptions, and they're both so wrong:
1) a good engineer is a good teacher
2) a good engineer is a good interviewer.
 
Folks, when adding bootstrap to our angular project, which one is the recommended one? ng add ngx-bootstrap or npm install bootstrap?
 
the former
 
@phenomnomnominal Is there any reason?
 
Do you know what ng add does?
 
9:20 PM
@phenomnomnominal stripping the jquery?
 
I mean in general, not specific to bootstrap
 
@phenomnomnominal No. I am about to learn Angular now. :-)
 
ng add is a command from the Angular CLI. It is responsible for not only installing npm dependencies to your codebase, but also for adding code to your actual application to help you get up and running.
When you run ng add ngx-bootstrap this code runs: github.com/valor-software/ngx-bootstrap/blob/development/src/…
 
@phenomnomnominal Very good information. Thank you very much!!!
 
It will do things like add the appropriate NgModules to you AppModule, insert the right styles and stuff
 
9:24 PM
I see. There are many boilerplates provided. OK. Thanks.
 
9:50 PM
What is the correct command to disable --strict when creating a new angular project? ng new appname --no-strict or ng new appname --strict=false? I tried both and I cannot find key-value pair in tsconfig.json that specifies that I have disabled strict mode.
 
10:04 PM
If you're starting a new project, seriously leave strict compilation on
 
@phenomnomnominal But the udemy instructor asked us to turn it off to avoid any errors.
 
😬
I mean if that's a course you're taking then follow it - but that is bad advice for a real world application
 
The problem is the video is more than 2 years old. Some results are out of sync between what he shown and what I get.
I didn't find key-value in tsconfig.json that explicitly specify that the strict mode is off.
 
hey can anyone take a look at my question and help answer it please
 
@noob_coder Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
10:55 PM
@VLAZ Thanks!
 
11:22 PM
time for some poe
 

« first day (4029 days earlier)      last day (910 days later) »