« first day (4361 days earlier)      last day (573 days later) » 

7:38 AM
Is this chatroom active?
 
@dmxt 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.
 
8:04 AM
 
 
1 hour later…
9:19 AM
@dmxt Some times
 
Inside an ES6 class constructor, how can I access a static field without mentioning the class's name? I'm looking for something equivalent to rust's capital S Self, so that when I copy over code from one class to another, I don't accidentally access a different class's static fields.
 
 
2 hours later…
11:01 AM
@ShaharNacht this.constrictor.myStaticField Although, I'd say the practice is a code smell. There are probably better way to do whatever you're trying to do than copy/pasting code and static fields.
 
11:17 AM
@VLAZ I see. what would you recommend instead? Maybe all of those classes extending some base class? I wish JS had interfaces, kinda scared to get into inheritance hell, but maybe it's the only option here...
 
I don't know what you're trying to do. I don't know what to recommend. Perhaps inheritance would work. It's very likely you just need composition.
 
What's composition?
 
12:10 PM
Composition over inheritance (or composite reuse principle) in object-oriented programming (OOP) is the principle that classes should achieve polymorphic behavior and code reuse by their composition (by containing instances of other classes that implement the desired functionality) rather than inheritance from a base or parent class. This is an often-stated principle of OOP, such as in the influential book Design Patterns (1994). == Basics == An implementation of composition over inheritance typically begins with the creation of various interfaces representing the behaviors that the system must...
 
1:07 PM
thx
 
1:50 PM
!! skyrim or subnautica
 
subnautica
 
O.o
 
hmm, weird how it choose one or the other. is it using random numbers or? I guess something might happen if you use the string in a different form, eg: "Skyrim" or "SkyriM" etc
or maybe it favors longer string, which might explain why it always choose "subnautica"
 
it's just a .random .floor
 
ah, I see
hmm, guess this make more sense now: stackoverflow.com/a/1527820/12349101
btw, I noticed only recently but, a lots of mod author like to use JS or variant of it (eg, react, etc) to make their mods. There a lots of them but it's hard to give any direct example, but one recent one comes to mind: reddit.com/r/skyrimmods/comments/ppecbx/…
 
2:59 PM
JavaScript is starting to become the Doom of the programming world. And I don't mean it endangers it (nor claiming that it doesn't) but just like Doom, it seems like everybody is trying to shoehorn run it everywhere.
This is the future of JS, it seems.
Which reminds me - I did play a game that boasted the ability to create your own spells. Through JavaScript. As in, you would be able to actually write the JS code for the spell's effect inside the game. Like doing stuff like target.push(10) to push them away with the spell.
It was in Early Access though, and I didn't see a good documentation of exactly what could be done. E.g., what exactly you could call on target. And the game consisted of some physics simulation challenges at the time. I really should check what happened and if they expanded on the concept in any meaningful way.
 
3:17 PM
@VLAZ oh, that sounds nice :o kind of like some form of DnD but using javascript?
but yeah, I agree with what you said above. I don't know if it's bad or not though as you put it, but it is getting predictable at least
 
@NordineLotfi It was first person, IIRC. Let me check what it was called.
 
@VLAZ nice, Thanks
It's a wonder I never heard of that one though.
 
3:47 PM
@VLAZ in inheritance all parents characteristic is available in child, but in composition you have to give access explicitly.
 
@YasinRahnaward 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 hour later…
4:52 PM
This is not a Javascript question, but more of a general one.

What would be your way of generating a HTML file on-the-fly, with the requirement that the file needs to be valid HTML all the time (as it needs to be saved every single time something changes)?

Performance is a key here, so rewriting the file over and over again is a silly solution.
The issue with HTML is that the tags should be closed on most of the elements, but if you generate on the fly, the last tags will be missing (if you generate from top to bottom).
 
5:09 PM
@Warcaith Use a templating engine? And write valid HTML? Doesn't seem like a very complex task.
Not really sure why the need to re-generate it, though.
If you keep the data, you can generate the HTML on the fly on the client. Which is pretty fast already.
 
@Warcaith I recall of the context from back then :) anyway, what do you mean by "the last tags will be missing"? how do you generate the HTML or update it? might give some clues on how to improve it so it doesn't have any missing tags
 
@NordineLotfi Haha you are here too. Nice too see you again. Looking for some different perspectives on the problem! :)
@VLAZ I'm using a template engine. What if you need to append new data in the middle of the HTML file and save it to the same file again after each append?
 
@Warcaith I see :D, yeah it's always good to get a feels for a different POV. If you were curious about a javascript solution, there are some example here: stackoverflow.com/questions/56709277/…
 
@NordineLotfi Well, I want for example that the </main><footer></footer></body> tags always exists at the end of the file, even if I append data to inside the <main></main> tag.
One way is to rewrite to file completely, of course.
 
why not use an if condition to add that at the end of the file? That way it's always present, even if you append things to it.
 
5:18 PM
Another way is to search for a tag and then write to that position in the file, but that is pretty expensive. Would perhaps work better if I search for it backwards though.
Could you clarify what you mean by that? I'm feeling so dumb talking about this again, but I need to figure out a good way doing this, as we'll have to deal with pretty large HTML files.

My suggestion was to write everything in another format and then transform it into HTML at the end, but there's the issue again... our stakeholders are scared to lose the HTML report evidence, which can happen if the post mortem action that transforms the data file to HTML never executes. Back to generating HTML on-the-fly again...
 
@Warcaith we could talk about this in another room if you want, since I think we might disturb people here a bit ^^ just a suggestion
 
You could perhaps save the results to a .json file actually and just include a .JS file in the HTML report that automatically unwraps all the data into actual HTML code!
Sure, how do we talk in another room?
 
@Warcaith Re-generate the entire document. Shouldn't really matter if you re-generate "the middle" or all of it. Should be the same thing in terms of speed.
 
@VLAZ Hmm, that's what I thought, as I need to find the position for the new element everytime new data needs to get appended.
 

« first day (4361 days earlier)      last day (573 days later) »