|
|
|
Good point ... Somehow, I doubt the sanity of the inventor of this ...
|
|
|
|
|
I want video.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
|
I only have one question...WHY?
PartsBin an Electronics Part Organizer - A updated version available!
JaxCoder.com
|
|
|
|
|
Props for the RickRoll.
I know people who might actually buy that.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
Is that a dog or a rabbit?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
It's a cross-breed rabdog
|
|
|
|
|
I've been learning React.
It's quite amazing actually.
I wanted to know what the impact of my simple Project* object would be if there were a lot of them.
Questions I Had
1. What If I Added 10,000 div nodes to my page?
2. What if I added 10,000 choices to a drop list (html select tag - option values)?
2a. Additionally, what if I added each Project object (serialized to string) as the value on the select tag option?
It performs amazingly well.
Bonus Info
Here's how you add a value to a drop list (select tag) in HTML / JavaScript:
let projectList = document.querySelector("#projectList");
projectList.append(new Option(p.name, value, false, false));
Add Object As Value
But, if you're an OOP person and you want to use a specific object whenever an item is selected int he drop list then you want to store the object as the value. That way, when the user selects the item you have the original object.
Since value expects a string you will need to do this:
projectList.append(new Option(p.name, JSON.stringify(p), false, false));
Now when the user selects an item in the drop list you simply parse the thing back to your target object.
The changehandler is my method which is fired when user selects a new value from drop list.
changeHandler(e) {
let item = JSON.parse(e.target.value);
console.log(`item.name: ${item.name}`);
}
But How Does It Perform With 10,000 Serialized Objects?
It's amazing. Takes < 1 second for drop list to respond.
Pics or it didn't happen. See snapshot here[^].
*Project Class
export class Project {
constructor(name) {
this.id = uuidv4();
this.ownerId = localUser;
this.name = name || '';
this.created = new Date();
}
}
File it under weird, but it is also quite wonderful.
|
|
|
|
|
But as we keep telling people in QA, a list of 10_000 items isn't much use to the user.
Until we get proper support for the selectmenu[^] element, you'd probably want to use a plugin like Select2[^] to add a search to your list.
But at that point, you might be better to use something closer to an "auto-complete" approach, and load the matching items on demand.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for the info on SelectMenu I will check it out.
|
|
|
|
|
I would suggest if you are liking React - make use of:
TypeScript - it's Javascript with strong typing and makes Javasript so much better to work with.
Redux - well worth doing the main Redux tutorial first and consider using it as it makes handling state much easier.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
You are right about TypeScript. It would be a lot nicer if the type I store and deserialize were known by the language itself.
|
|
|
|
|
Need a recommendation from you.
Am planning to write a 3D game in JavaScript, a small hobby project, which uses Three.js library. Is it better written in ReactJS (which I have to still learn), or in plain Vanilla JS? What would you recommend?
|
|
|
|
|
If you're basically using HTML5 CANVAS which you probably are, then I would most likely go with vanilla JS.
React basically gives you a way to manipulate the HTML DOM that is fast and easily updateable.
But if you're not using much DOM because your game runs in the Canvas then you really won't get much out of React anyways.
Also, if you are going to have a Canvas area and then DOM elements surrounding it you can even add React later to manipulate those DOM elements so you won't have to begin with React anyways and it will be easy to later incorporate React.
That's actually one of the really nice things of the React framework.
Hope this helps. Good luck!
|
|
|
|
|
Thanks a lot.
My app will have one big screen-wide canvas (except for a small controls area). I will go with plain Vanilla JS to start with.
|
|
|
|
|
raddevus wrote: What if I added 10,000 choices to a drop list
Myself I would tag that as a bad UX design.
As a back end developer who was requested to populate it I would refuse to do it without paging. Since I know that if there are 10,000 now then there are going to be 100,000 next year. And when that blows up I can't point to the UI as the problem.
|
|
|
|
|
I've been using this DOS/Windows sh*t for 40 years. When did Type start supporting wildcards?
C:\>Type somefile*
somefile1.txt
contentcontentcontent
contentcontentcontent
contentcontentcontent
somefile2.txt
contentcontentcontent
contentcontentcontent
contentcontentcontent
somefile3.txt
contentcontentcontent
contentcontentcontent
contentcontentcontent
...
|
|
|
|
|
|
Not exactly right: I tried in Windows 98 and doesn't work
In W2k it works however. Don't have a NT installation to check.
Mircea
|
|
|
|
|
You still use Win98?????
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Not exactly: I have VMs with all (ok, almost all) MS OS-es and the "forever" answer made me chuckle and test it on Win98 and Win2k
Mircea
|
|
|
|
|
I don't recall it ever not working. But I have no way to test it. I have a DOS 6 floppy somewhere...
It's possible that I'm just thinking of OpenVMS, and assuming that DOS did it as well.
I'm sure I've done things like TYPE *.txt > combined.txt to make one big file.
|
|
|
|
|
I liked working on VMS and DCL. That's the environment my first programming job was in.
Scott
|
|
|
|