Questions tagged [javascript]
JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.
2,128 questions
-2
votes
1
answer
80
views
Are there any good and modern approaches, to have variables that feel global (no need to pass them around explicitly), yet are local to an instance?
I'm developing a library in JavaScript (TypeScript, actually) which is split into several modules. It's meant to run both on the web and in non-web environments like Node.js.
The library is meant to ...
-4
votes
3
answers
256
views
Optimizing a "Transfer-Encoding: chunked" parser [closed]
I have written a parser for Transfer-Encoding: chunked requests over HTTP/1.1. Now I'm working on optimizing the code. This is the specification 7.1. Chunked Transfer Coding.
The first optimization ...
-4
votes
2
answers
253
views
How to design a Transfer-Encoding: chunked parser of Uint8Array's in JavaScript? [closed]
I'm working on implementing parsing a series of Uint8Arrays that contain Transfer-Encoding: chunked data sent from the client using WHATWG Fetch over a single connection.
For example, writing 1 MB ...
3
votes
3
answers
236
views
Best Practices for Implementing a Heartbeat Feature in a Laravel App to Track Offline Status
I'm trying to implement a heartbeat feature for offline tracking that just sends an offline message to the server once the web browser app (Laravel-based) is offline. Ideally it will ping the app's ...
2
votes
1
answer
106
views
How can I generate visualizations in JavaScript using data and packages from R?
I have a tumor dataset in R that is a Seurat object. I am working on a project to develop a new visualization tool for single-cell RNA-seq data. I want to develop the visualization using JavaScript, ...
3
votes
3
answers
194
views
Why does the collection library for Dart use a bit mask for hashing collections?
I was implementing a hashing function for a class and I took a minute to look at the first-party collection package for Dart to see how they implemented their hashing function for collections. They ...
5
votes
2
answers
1k
views
Performance consideration for cascading style sheet implementation
I have the plan for an UI component hierarchy. Each UI component contains zero or more children UI components, and each UI component may set an optional theme.
A theme is responsible for skinning a ...
1
vote
4
answers
364
views
Synchronized Web Audio Playback on Multiple Smartphones Using Timestamped Chunks and Manual Time Shifting
Note: I am not super knowledgeable web javascript or streaming, but I have read this and this and this I am proposing an alternate idea and just trying to verify whether I have a sound starting point ...
-2
votes
1
answer
81
views
Advice on how to ensure input only comes from my website component?
I have a website with an online keyboard. Essentially people can type on this online keyboard and send messages worldwide.
My problem is users can easily intercept the POST network call to the backend ...
2
votes
1
answer
517
views
Unit testing a Web Worker in JavaScript/TypeScript - Best Practice
I got assigned with writing unit tests for a class that instantiate a Worker inside in it's constructor. The code looks simmilar to this,
class SomeClass {
private _worker: Worker;
constructor(...
-4
votes
1
answer
104
views
How to develop portable HTTP clients across js/ts web frameworks? [closed]
Related: Best practice for interoperable TypeScript→JavaScript? - Frameworks, browser extensions
Angular, React, Vue, Svelte &etc. exist and are popular. Some use rxjs to flow from HTTP response, ...
0
votes
2
answers
276
views
How can I write more optimal code keeping Javascript "shapes"/"hidden classes" in mind?
All optimising Javascript runtimes use "shapes" (SpiderMonkey term) or "hidden classes" so that instead of objects being treated as the dictionaries or hashmaps they can instead be ...
0
votes
1
answer
146
views
Where to store important information needed for the UI in Vue? (Name etc)
I am writing an application using a C# backend and a Vue frontend, and I am a bit sceptical about where is best to store information about the user that is currently logged in.
There are a few posts ...
4
votes
5
answers
627
views
Is changing the signature of a callback a breaking change?
In Javascript, should appending to the signature of a callback be considered a breaking change?
I.e. given an operation op(target, callback) should changing it from callback(item, index, array) to ...
0
votes
0
answers
82
views
approximating a shape with a line
I have an image that has been converted to an svg.
The conversion looks fine, but it has prefered to use fill instead of stroke.
This in itself is not a bad thing in terms of converting a raster image ...