Skip to content

Author: admin@master

disconnect client from socket.io id

I can connect specific player to specific room like: And documentation says that ‘you can use leave method to leave room’ like: But I just want any client to leave using io object instead of socket. I need something like: Is there any way to leave client from room using just socket id with io obje…

querySelectorAll is not a function

I’m trying to find all oferts in the var articleFirst, but the return message in the console says that “querySelectorAll” is not a function. Why I do get that error? This is my HTML: This is my JavaScript: Error: Uncaught TypeError: articleFirst.querySelectorAll is not a function Answer Try …

How to convert file to base64 in JavaScript?

UPD TypeScript version is also available in answers Now I’m getting File object by this line: I need to send this file via json in base 64. What should I do to convert it to base64 string? Answer Modern ES6 way (async/await) UPD: If you want to catch errors

event.clipboardData.setData in copy event

I have looked at many posts but could not find a clear current answer to the following two questions as it seems standards and browser support has been constantly changing. Is it a legal operation according to the standard to change the clipboard with event.clipboardData.setData inside a ‘copy’ ev…

ReactJS: setTimeout() not working?

Having this code in mind: Isn’t the state supposed to change only after 3 seconds? It’s changing immediately. My main goal here is to change the state every 3 seconds (with setInterval()), but since it was not working, I tried setTimeout(), which is not working either. Any lights on this? Thanks! …