All Questions
Tagged with lazy-evaluation javascript
80 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(...
-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 ...
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="/...
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({...
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....
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 ...
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 ...
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/...
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 ...
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 ...
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 ...
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 ...
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>
...
-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: ...
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) =>
(...