29,963 questions
1
vote
2
answers
57
views
ES6 static class extends EventTarget
I wish to create a class which extends EventTarget, allowing addEventListener() and dispatchEvent() to be invoked on it.
Logically, my class wants to be a singleton; if a page accidentally ...
1
vote
0
answers
42
views
Inheriting constructor documentation in JSDoc with ES6 classes
I am writing documentation for some classes written using the ES6 class syntax. I have some classes which inherit their constructor from their parent class, as below:
/**
* @class
*/
class Parent {
...
-1
votes
0
answers
14
views
Jest different mocks per test case/test suite
Context
Hi, I am trying to learn how to test my code.
I am using node.js, TypeScript and Jest with ES6.
I have a constant timeConstraints that holds an object which its values changes for each run of ...
1
vote
2
answers
46
views
Alternative to 'assert' in Node JS with strict mode
I have a Firebase Functions project that has "type" set to "module" in package.json so that I can use ES6 syntax. Some of the files import data from another json file with a line ...
-4
votes
1
answer
70
views
Why is the return not excuted? [closed]
my codes
console results
Here are my React codes. I know that if you write a function with a parenthesis, it will be called immediately (in this case, it will be called when elements render, I have ...
-1
votes
1
answer
64
views
How to import a component from published library and how to get component key
I'm working on a figma plugin where in I need to use the components
which are in published library assets. I know I should be using
figma.importComponentByKeyAsync() of figma plugin API, but I m not
...
0
votes
0
answers
59
views
How to solve Open Redirect vulnerability
In a webapp we are trying to solve an Open Redirect vulnerability.
The code is like this:
window.location.href = DOMPurify.sanitize(data.href);
Which apparently is vulnerable. One recommended solution ...
0
votes
0
answers
112
views
Dynamic import of component - missing the getter in Svelte 5
I wanted to import component dynamically to create something like a blog in Svelte 5. Very similar to this approach here in Svelte 3 or 4:
https://github.com/ScriptRaccoon/blog-sveltekit-approach/tree/...
1
vote
1
answer
39
views
Why do private fields not get overridden in subclasses?
I'm trying to create a parent class A with a private field #abc and a subclass B that overrides this field. However, when I call methods from the parent class that access the private field, it still ...
0
votes
1
answer
17
views
Safari modulepreload for relative paths fails
I am including the vega module in a module:
import vega from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
This works without console errors on Chrome, Edge, and Firefox, but not Safari.Inspecting ...
0
votes
0
answers
42
views
Using Javascript import to replace a require() call when importing from a Typescript module
I am maintaining some Javascript code in a React application that imports from a Typescript library using the require function.
The import statement looks like this:
const utc = require('dayjs/plugin/...
0
votes
0
answers
35
views
Cant populating existing datatable es6+
Link to test case:
https://codepen.io/arcanisgk-the-sasster/pen/ZYzJqwG
static async updateTable(info) {
console.log("DatatablePlugin.updateTable");
const table = ...
0
votes
1
answer
37
views
Does CloudAnt support ES6 functions or not?
The CloudAnt server says it is using CouchDB 3.4.2, and ES6 support was added to CouchDB in version 3.0..., but I am not able to use fat arrow function syntax in the online view editor for my ...
0
votes
2
answers
65
views
Unexpected result is return by document.getElementsByTagName and javascript behaviour
HTML :
<html>
<body>
<div id="a">
</div>
</body>
</html>
Above is my simple html given and i wrote a function to add a children div ...
2
votes
0
answers
71
views
I am unable to get Promise.allSettled() to trigger when the provided Promises are fulfilled
I am trying to create a list of Promises for collecting data from an API, and then once all of the Promises are fulfilled (either resolved or rejected, it doesn't matter), run another call to the API. ...