« first day (3830 days earlier)      last day (1103 days later) » 

user14853506
2:54 AM
I want to fetch some JSON data:

const adUrl = fetch(`https://api.etherealads.co/api/api/v1/latest.json`)
I console.log it, and I get

Promise {<pending>}
So I try:

const adUrl = fetch(`https://api.etherealads.co/api/api/v1/latest.json`).then((response) => response.json());
console.log(response);
That returns:

Uncaught ReferenceError: response is not defined
Oh, I see:

const adUrl = fetch(`https://api.etherealads.co/api/api/v1/latest.json`).then((response) => response.json()).then(data => console.log(data));
 
@ButWhyTho1375 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.
 
 
3 hours later…
6:11 AM
I am fetching this data and i want to map names from this object into a react select menu how do i do it? teacher profile data
{…}

data: (6) […]
​​
0: Object { status: "COMPLETED", _id: "606bf5d19173931121c0017c", name: "Admin1", … }
​​
1: Object { status: "PENDING", _id: "606c074e9173931121c0017f", name: "Admin3", … }
​​
2: Object { status: "PENDING", _id: "606c07a99173931121c00182", name: "Admin4", … }
 
@AvinashToppo 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.
 
!!help
 
Command documentation and syntax can be found here.
 
 
5 hours later…
10:55 AM
Does anyone know if there is an api to check whether the user has granted clipboard access? (without prompting if not)
 
11:07 AM
@Myzel394 Dunno, but it looks like there is no such general option. There is a Permissions API for that purpose but clipboard-read seems to be only implemented on recent chrome browsers.
or clipboard-write
 
Are you sure the Permissions API works with clipboard? because MDN says:

Not all APIs' permission statuses can be queried using the Permissions API. Notable APIs that are Permissions-aware include:

Clipboard API


(sorry I don't know how to cite in markdown :C)
 
The Permissions API itself should exist on modern browser, for querying the permission status, but the browser compatibility matrix shows that clipboard-read and clipboard-write are only supported on modern chrome based browsers (chrome/edge/android chrome/...)
so I'm sure it does NOT work everywhere
 
Oh didnt't see that section! Thank you, luckily I just need to support Chrome :D, so that will work
 
guess it should be easy to write a small test if it works or not^^
 
11:28 AM
for me it works on chrome and throws a TypeError on FF
 
Same, will use this with a try-catch block and simply return false if it's not supported :D
 
at least I think it works.. I'm getting "denied" thought it should be prompt..
hmm
 
In case you're curious, I made a typescript version and wrapped it in a little function: jsfiddle.net/boLs562z
 
nice^
Ah.. prompt doesn't work in jsfiddle. Getting a DOMexception about document not having focus. I bet that is some sort of security measurement.
TIL
 
11:54 AM
Yes I also encountered that when I tried to prompt me using navigator.clipboard.readText(). Just used setTimeout, that worked
 
 
3 hours later…
3:02 PM
Hi, yesterday I asked about an issue I encountered in my discord.js code. Here's the question: stackoverflow.com/questions/67038984/… . Can anybody help me?
 
@BasZ 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.
 
3:32 PM
Hello
I am trying to implement pagination on Kendo Grid - ReactJS
but every time when I render the page, all records are visible, but should be for example 10
 
 
1 hour later…
4:45 PM
alright fine, graphql is pretty cool
 
 
2 hours later…
6:21 PM
Hey guys, have anyone worked with Typed js before? Is there any way to include it in a vanilla js app with cdn? I am kinda unclear with using import statements for packages delivered via cdn!??
 
 
1 hour later…
7:58 PM
i, have been banned for asking questions on stack overflow, what is the reason?
 
@AndriNic 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.
 

« first day (3830 days earlier)      last day (1103 days later) »