Category "javascript"

Canvas putimagedata is sometimes not drawing like expected

I am trying to draw a simple flat line from the left center of my canvas to right side. The starting and ending points will be taken from textbox input. To do t

JavaScript to control play/pause embedded YouTube videos

I need to embed multiple YouTube videos on a website. For each video, I need to set up an external element (such as a paragraph, image, div, etc) that can trigg

MediaDevices.getUserMedia() prompts the user for permission then launches camera app on full screen instead of in-browser

I am using getUserMedia() to take images on a vue web app. Working everywhere except on iOS safari. The user is asked permission for accessing the camera, aft

How to add items from object in DOM with button click in javascript?

first time posting in here :) I have recently started coding and for JS study practice, I wanted to make a button in my navbar that generates an object to DOM a

Stand-alone React 18 page warning: importing createRoot from "react-dom"

I'm trying to create a stand-alone webpage that uses React 18: <!DOCTYPE html> <html lang="en"> <head> <title>Hello React!</

Cannot update a component (`BrowserRouter`) while rendering a different component

Warning: Cannot update a component (BrowserRouter) while rendering a different component (Register). To locate the bad setState() call inside Register, follow t

How to delete a document attribute in Sanity iO?

I have an array of objects in my Sanity Document called Images called Comments an example comment object in comments[] array looks like : { "_key": "651

Cannot update a component (`BrowserRouter`) while rendering a different component

Warning: Cannot update a component (BrowserRouter) while rendering a different component (Register). To locate the bad setState() call inside Register, follow t

How to get first N number of elements from an array

I am working with Javascript(ES6) /FaceBook react and trying to get the first 3 elements of an array that varies in size. I would like do the equivalent of Linq

React Big Calendar Navigate

In my calendar, I made the option to open and close it, but when I close it, and open it again, it is in the month I stopped after closing it, and not in the cu

Go to definition programmatically with language server protocol

I have created my own Xtext based DSL and vscode based editor with language server protocol. I create multiple models in separate files: # filename dummy1.xyz m

Radio button validation alert not showing - works on everything else

I'm creating a cfmail form for a nonprofit to allow potential vendors to request a spot at the next fundraiser. All fields are required but the radio buttons ar

How do I set webpack mode

I'm trying to configure my script (in package.json) in such a way that I can run webpack in production or development mode via cli. package.json "scripts": { "s

BottomNavigation in MUI cannot resize smaller than 400px if containing 5 items

I have a bottom navigation that contains 5 elements. When you resize the window lower than 400px, the bottom navigation doesn't "squeeze", so to say; it remains

React-Typescript: I don't find the problem why my getCurrentTime Function won't work

I am trying to write a function to display the difference time between current time and e.g. the creation time of a message. Herefore I wrote a function to get

VSCode `typeAcquisition` for browser imports

I want to have .d.ts typings for Lit which will be served from the esm.sh CDN. I want to use VSCode's built-in type acquisition system to get Intellisense for t

How to get a better approximation of a thick bezier curve?

Let's say I already have a bezier curve approximated by many straight lines (the bezier array in the code), and I would like to draw it with a series of rectang

Generic Events Emitted from Component in Angular ~13

I'm trying to determine if I'm going down an undesirable path with how I'm approaching generic event management in an Angular application. The question I have i

fabric.js updating Line coordinates inside of a Group

I have set up the functionality that I want with a regular line using fabric.js. See the code pen below. I can hit the add arrow button to add a line to the ca

How to set custom scale to polar area chart?

The Problem: I am using polar area chart. For slices in this chart, each value after the largest value should appear one level smaller. The level is as follows: