4 ms·
You can load any file from server into string. Use for example fetch call to do it. You can then assign innerHTML property of any DOM element of your choosing t
by FpUser 4y ago
You can load any file from server into string. Use for example fetch call to do it. You can then assign innerHTML property of any DOM element of your choosing to that string [0]. The string can contain any valid HTML and JavaScript. This makes your front end modular and scalable. It is dead simple and does not require anything but plain JavaScript.
It is amazing how modern web developers flock to that mess of frameworks and tooling to achieve what basic JS and no tooling do way more efficiently and with less time spent.
[0] - https://www.w3schools.com/jsref/prop_html_innerhtml.asp https://www.w3schools.com/jsref/prop_html_innerhtml.asp
- komali2 4y agoInteresting idea, though I'm wondering for example how you manage namespaces, or for example one component extending or using another one. Do your various modules just have lots of checks about certain valid states on the global namespace?
- FpUser 4y agoYou can do some reading about state machines and their executors if you are curious about ways of managing states. I do not keep to single tool / strategy etc and use whatever I believe is the best choice for particular task. I write everything: firmware for MCU, multimedia apps with hardware accelerated graphics, enterprise backends and middleware, web front ends, device control and whatnot, so while some tech is universal the specifics can be highly different.
- komali2 4y agoOh, I'm aware of the theoretical concepts of state machines etc, I guess I was asking about more in-the-weeds levels, but it sounds like you really and truly are just approaching these problems from engineering fundamentals and coding from scratch. That's pretty cool. All you've done is just pique my curiosity further though, I would love to be able to work on such a wide breadth of fields, are you open to sharing how you get to work in such a variety of platforms? I'm at the point in my career where I'd like to aggressively move off all the web-only work I've done the last half decade or so.
- FpUser 4y ago>"I would love to be able to work on such a wide breadth of fields, are you open to sharing how you get to work in such a variety of platforms?" I guess we have different education and general background. I am 62 yo fart. Was raised in former USSR in a satellite town that existed soleily to accommodate bunch of scientists working in various fields. When not in school I would spend my time visiting my parent's place of work and got to play with very cool "toys" and people there were nice enough and let me "work" on tiny projects of various nature. I then done my M.Sc. in physics / biophysics and continued to work as a scientist. So I was basically trained to solve various problems in creative manner. Was never trained specifically in software. I had wonderful teachers and mentors and can't ever express enough gratitude to them. Many of them are dead by now anyways. During a course of my work as a scientist I needed to design various mechanical gizmos, electronics (digital and analog) and write some software since nothing existed for my particular field. I just got myself whole bunch of books and read and tried until I succeeded. Then "perestroyka" started and I began to supplement my "official" income with writing a software as an independent consultant. Computer industry back then was very young, and I had no troubles finding contract work to create various products. My first side software project was PC based visual designer (something akin to music sequencer) to control lighting system for big theater. I then immigrated to Canada and eventually ended up working basically as chief software product designer and implementor. First as an employee in software development company and then on my own. As for diversity of the fields - when working on particular product I imagine software as a bunch of living components interacting with each other. I then nail down what those components and interactions are. I then get down to implementing it. Particular computer language, deployment platform and other pesky details are the last thing I worry about. Over the years I've accumulated large portfolio of products and present those as a references when getting new contracts. I mostly deal with business owners and those do not give a flying fuck about languages. They want actual problems solved. >"coding from scratch" I do extensively use various libraries. But very specific problem oriented. Like graphics libraries. I avoid frameworks like a plague most of the time as those in my opinion degrade creativity and keep one hostage.