« first day (3290 days earlier)      last day (1871 days later) » 

12:07 AM
 
8 hours later…
8:29 AM
anyone know how to render 3d images in vuejs?
 
3 hours later…
11:05 AM
seems like a dead room over weekend
can we download already loaded images from a page
or do we must need to download them using urls again
someone loads a page with lots of images, then there internet stops working, how can we provide them functionality to download all images on the browser
I assume it would be possible somehow
but a more explicit approach would be to download the image in the javascript and fill the html with the data instead of the url
that way, the javascript still has access to the image data
otherwise, you probably must load it from the cache or something
you are right
but it doesn't sounds straight forward
 
3 hours later…
1:51 PM
hi
How to make slickdots clickable ?
like second dot should show up second slide
Sam
Sam
Hey guys, I'm having a bit of difficulty understanding async calls in functions
const fetchData = async() => {
    let url = 'http://localhost:81/'
		let options = {
			method: 'GET',
			mode: 'cors',
		};
    const json = await caller(url, options);
    return json;
  };

  useEffect(() => {
    const json = fetchData();
    console.log(json);
    json.data.reverse();
    ...
}
in useEffect(), the json variable assignment does not seem to be populating even though I explicitly await the response of a caller() function which grabs data from some resource. Am I implementing this incorrectly?
@Sam Since fetchData is itself async, it returns a Promise, which must be awaited in turn.
Sam
Sam
so useEffect should be async and const json = await fetchData() ?
@Sam The callback you pass to useEffect should be async, yes.
You should first look into and make sure that useEffect's callback is even allowed to be async.
React is calling it behind the scenes, you can't be sure how it does that. (Look in the docs)
Sam
Sam
Ah ok that does seem to fix it. However I do get some warnings in the console. Effect callbacks are synchronous to prevent race conditions. Put the async function inside
2:05 PM
I don't know what putting the async function inside means.
Sam
Sam
They've given an example
useEffect(() => {
  async function fetchData() {
    // You can await here
    const response = await MyAPI.getData(someId);
    // ...
  }
  fetchData();
}, [someId]); // Or [] if effect doesn't need props or state
@Sam Uhh, sure, I guess.
So just do that, I suppose
Sam
Sam
Yeah, i feel its a little messy having an internal function having to call another function outside the useEffect function, but I guess it works for now
2:46 PM
OP : window.location isn't working
Answer : use window.location lol https://stackoverflow.com/a/58463381/2427065
 
3 hours later…
5:45 PM
hello fam
@RaymondHsu Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
ok...?
 
5 hours later…
10:58 PM
hello

« first day (3290 days earlier)      last day (1871 days later) »