Skip to main content

All Questions

-2 votes
1 answer
129 views

Lazy logging evaluation in JS? [closed]

Is there a way to do lazy evaluation when logging? For instance console.log("Result: ", throwingFunc()) won't log the first argument ("Result: "), as the 2nd argument, throwingFunc(...
Tar's user avatar
  • 9,075
-1 votes
1 answer
298 views

Remove a class after image is loaded

I'm trying to find a simple way using JS to implement Boostrap 5 placeholder to lazy each image that I load. Bootstrap 5 has a class named placeholder that adds a visual “loading card” to a component ...
btros's user avatar
  • 11
0 votes
0 answers
38 views

Questions on the lazyload method

I added the lazyload to the image tags. Saw the loading and then the actual image. I was shocked to see the code change (src, lazyloaded) when viewing the source code. Source code: <img src="/...
Sam Mah's user avatar
  • 39
0 votes
1 answer
92 views

List Traversal in a lazy setting that produces expressions in WHNF

I simulate lazy evaluation, i.e. evaluate only when needed and only once, in JS with Proxy and run into a problem with Traversable (mapA instead of traverse at the term level): const r = List.mapA({...
user avatar
0 votes
0 answers
177 views

Memoize object lazily so that first attempt to access it would load it

Is there some npm package for memoizing object lazily, so that the first attempt to access it would load it? The problem: // service class Service { private readonly pathMap = { user: process....
Shl's user avatar
  • 3,718
5 votes
4 answers
305 views

Sieve of Eratosthenes in Javascript vs Haskell

I've been playing around with Haskell and find it fascinating, especially the Lazy Evaluation feature, which allows us to work with (potentially) infinite lists. From this, derives the beautiful ...
André Alçada Padez's user avatar
0 votes
1 answer
325 views

Only display icon in parent if there's the relevant data in child component, but in order to have the data I must click on that icon

Alright, it took me awhile to even formulate the question for this. This is more related to a design strategy rather than anything. I have a view that contains a table that displays a list of all ...
Rafael Santos's user avatar
2 votes
1 answer
4k views

How to lazy load new Google Adsense code using JS

Google has replaced <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js</script> with <script async src="https://pagead2.googlesyndication.com/...
Anonymous Girl's user avatar
0 votes
0 answers
201 views

How to transform this code from using double await to one await for lazy loading import

I'm using Svelte and Protobuf generated clients. In ./generated/index.ts I'm using this code: import type { PlayerServiceClient } from './proto/player.client'; const transport = new ...
Fred Hors's user avatar
  • 4,085
2 votes
0 answers
152 views

Lodash's shortcut fusion with lazy evaluation doesn't optimize

I'm trying to test Lodash's lazy evaluation and shortcut fusion but it seems like the shortcut fusion works for very limited cases. For example, I'd expect the following to be performant and should've ...
pranavjindal999's user avatar
2 votes
1 answer
89 views

Problems with Loading lazy

I'm trying to apply lazy loading to the images on my website when I apply it on a static image through a URL or assets, this attribute works perfectly But, when I get images from my database and apply ...
jagcweb's user avatar
  • 350
0 votes
1 answer
1k views

Accessing lazy global variable from API in stimulus framework

I'm trying to make a Stimulus controller which would access global Youtube Player API variable Youtube Player API is lazy loading - it's class is loaded asynchronously // 2. This code loads the IFrame ...
Mateusz Moczydłowski's user avatar
0 votes
3 answers
2k views

Are helper functions defined inside a React component re-evaluated every time the component is used?

Say I have a React component that looks like this: const MyReactComponent = (props) => { const my_function = () => {// do some stuff...} return ( <div> <p> ...
Asker's user avatar
  • 1,735
-1 votes
1 answer
492 views

Javascript (target.className) if element has multiple classnames [duplicate]

I have an issue with my Javascript code and I hope somebody can help me with this. I created an lazy load function for images. <script type="text/javascript"> let options = { root: ...
Jan Bloemkool's user avatar
0 votes
1 answer
130 views

How to await an Array of async Tasks without blowing the stack?

A large array of Tasks blows the stack if you want to await them all, even if the array fold is stack-safe, because it yields a large deferred function call tree: const record = (type, o) => (...
user avatar

15 30 50 per page
1
2 3 4 5 6