725 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
81
views
I want to initialize my input signal with a default class and some data manipulations
I am using this package, ang-jsoneditor, which contains the below initialization code.
@Component({ ... })
export class AppComponent {
public editorOptions: JsonEditorOptions;
public data: any;
/...
0
votes
1
answer
99
views
How to isolate the execution of JS code, such that each script is executed within a "container"? Tried shadowDOM and IIFE, does not do the job
I have 2 js files - dashboard.js and statuspanel.js. They render React components inside the div that has the name of the script as it's id. For example, in my JSF application. The JS files are auto-...
0
votes
0
answers
28
views
IIFE is not giving any output [duplicate]
I tried IIFE in js, but its not giving any output
if I am not executing any other part of the code in the program except this function(using node)
When I tried executing or printing any other thing ...
1
vote
1
answer
83
views
Why can't I access path variable inside IIFE?
When I write const path = require('path') outside the IIFE function I can't access it inside, but when I write it inside the function I am able to access it. Can anyone explain why is this happening?
...
1
vote
0
answers
43
views
JavaScript Immediately Invoked Function - Distinguishing Between JavaScript Function Expressions and Declarations [duplicate]
In my journey of learning JavaScript, I encountered my first practical use case for an Immediately Invoked Function Expression (IIFE).
However, I'm struggling to understand the distinction between a ...
0
votes
1
answer
503
views
vite build lib iife with react components
Updates:
Here is the complete error
my-lib.iife.js?ver=1.0:9 Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following ...
0
votes
1
answer
336
views
Puppeteer script does nothing in NodeJS
I tried to install Puppeteer in a fresh NodeJS project. When I tried to launch a browser and take a screenshot it did not work.
I did:
make new directory
in terminal npm init -y
create file index.js
...
1
vote
0
answers
66
views
Asynchronous Behavior in JavaScript: setTimeout and IIEF [duplicate]
var arr = [10, 24, 15, 4];
for (var i = 0; i < arr.length; i++) {
setTimeout(
(function (index) {
return function () {
console.log("index:" + index + " element: " + arr[index]);
...
1
vote
1
answer
242
views
Converting IIFE to ES6 module: export a single parent object or individual functions?
I have a Javascript file that contains an IIFE. This IIFE returns an object with many utility methods. If I want to convert this to an ES6 module, should I export the containing object or should I put ...
0
votes
0
answers
57
views
ES6 Class compilation to ES5 function constructor
I noticed something while playing with Typescript's compiler options. (Typescript is irrelevant here, I'm just using it as a compiler much like babel)
So, I have this code in .ts file
(function () ...
0
votes
0
answers
41
views
Possible bug issues from creating curve union of multiple curves
I have an issue with using curveunion to combine curves into one object. Here is the link to my problem:
https://jsfiddle.net/aaronamran/nskuy632/4/
Here is the code for the beam class:
class beam {
...
0
votes
0
answers
215
views
Is there an existing workflow for Javascript module code isolation?
When making an app to run on a web page with ES6 code, multiple instances of the app have conflicts when using static variables or singletons.
Iframes are commonly used and provide code isolation ...
0
votes
1
answer
734
views
Remove Webpack's IIFE module wrapping to produce a raw JS script bundle file
I use Webpack 5 in my .net application to bundle my JavaScript and LESS files. I have multiple JavaScript files and need to bundle them into one file. After bundling into one file each separate ...
1
vote
1
answer
50
views
IIFE strange behavior linked to variables declared with let or var
I try to understand why the variable 'Permissions' will be typeof 'function' when Permissions declared with var but typeof 'object' when declared with let (which is the excepted behavior)
With 'var' - ...
2
votes
1
answer
90
views
Why second console.log output is the function body rather than 20?
(function b() {
console.log(b);
b = 20;
console.log(b);
})();
I wrote this JavaScript IIFE.
The first console.log logs the function body.
Then the b variable is created with value 20.
The ...