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,127 questions
2votes
1answer
75views
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, ...
3votes
3answers
159views
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 ...
5votes
2answers
1kviews
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 ...
1vote
3answers
192views
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 ...
-2votes
1answer
62views
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 ...
2votes
1answer
266views
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(...
-4votes
1answer
72views
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, ...
0votes
2answers
174views
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 ...
0votes
1answer
113views
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 ...
4votes
5answers
555views
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 ...
0votes
0answers
67views
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 ...
-2votes
1answer
190views
What is the best way to cache paginated data when any page can be moved to and page size is changeable?
I have a React Redux web app that fetches data from an Express/Node backend and MySQL database. I have a table of records that I fetch and store in redux as an array of objects, which I display as a ...
-2votes
1answer
106views
Advice on data structure for an analysis and visualisation tool (javascript)
I am writing a browser-based tool to manipulate and visualise data (with D3.js). Currently, I store data in a JSON format, where each table is an object and columns are arrays. eg: { "data&...
0votes
1answer
630views
MongoDB schema: optional vs. nullable
If I have a schema that includes fields that may or may not be set, what is the best way to handle these fields? Should they be optional or instead nullable? Here an example (Mongoose/NestJs) @Schema()...
0votes
3answers
235views
How to filter "locally and remotely" in functional programming
My example applies to reading and deleting files (I/O), but this is probably a common scenario (eg, keeping local and global state in sync in functional programming). I am reading in files from a ...