Windows + Chrome... Not sure what input I could offer... it's like the entire application is rendered three times... scrollbar on the right... I didn't interact much, so unsure if it's from the start or each interaction. It is a bit of an odd behavior... the models for all three seem to be the same as changes in one change the others.
Coll... didn't dig in as I don't have time. Advice below.
These *should* be SVG based with minimal JS and not using any heavy libraries... none of this should add more than a couple kb to your payload. So evaluate what you're using.
I've seen a lot of poor practice in terms of using shared UI libraries, many include far more than they ever should.
Should add a note that for..of over strings will give you surrogate pairs and is the most reliable means of doing so for Unicode sets.
// will only print one line for the pair.
for (const c of '\uD83D\uDE00') {
console.log('-', c);
}
This is a pretty good demonstration of the pattern. I will say that in practice, I would prefer to simply use bare object syntax over the use of new with constructor functions. When I do use constructors, I'd now prefer the class syntax.
class Employee {
constructor(type, name) {
this.type = type;
this.name = name;
}
}
class Developer extends Employee {
constructor(name) {
base("Developer", name);
}
}
class Tester extends Employee {
constructor(name) {
base("Developer", name);
}
}
class EmployeeFactory {
static types = [
Developer,
Tester,
}
create(type, name, ...options) {
const TypedEmployee = EmployeeFactory.types[type];
return TypedEmployee && new TypedEmployee(name, ...options);
}
}
I did put type before name above, as imho it should be first as this will work better with a spread operator.
Should add a note that for..of over strings will give you surrogate pairs and is the most reliable means of doing so for Unicode sets. // will only print one line for the pair. for (const c of '\uD83D\uDE00') { console.log('-', c); }This is a pretty good demonstration of the pattern. I will say that in practice, I would prefer to simply use bare object syntax over the use of new with constructor functions. When I do use constructors, I'd now prefer the class syntax. class Employee { constructor(type, name) { this.type = type; this.name = name; } } class Developer extends Employee { constructor(name) { base("Developer", name); } } class Tester extends Employee { constructor(name) { base("Developer", name); } } class EmployeeFactory { static types = [ Developer, Tester, } create(type, name, ...options) { const TypedEmployee = EmployeeFactory.types[type]; return TypedEmployee && new TypedEmployee(name, ...options); } } I did put type before name above, as imho it should be first as this will work better with a spread operator.