I’ve been trying to make a discord bot using discord.js, but I can’t seem to find any documentation on how to create a role that works in 2018. All the ones I can find that work, no longer work as they have removed the referenced function. In https://discord.js.org/#/docs/main/stable/class/Role th…
Tag: javascript
Vue cli 3 display info from the package.json
In a vue cli 3 project I want to display a version number in the webpage. The version number lies in the package.json file. The only reference to this that I found is this link in the vue forum. However, I can’t get the proposed solution to work. Things I tried Use webpack.definePlugin as in the linked …
I can not write any value from input on mobile device
I have a problem with touchstart in my jquery code. My jquery code doesn’t allow me to click any button, input or other elements when I open the page with a mobile phone. Please click this DEMO . You can click the inputs and you can write something on there. But open chrome developer console now click t…
Detect an URL change in a SPA
I would like to listen to path changes in a SPA which is not maintained by me. I found one solution here: https://stackoverflow.com/a/44819548/7042552 But still, it seems kind of “hacky” to me – but still my implementation is like this: Is there a better or more generic way to listen for pag…
sequelize compare date with date-timestamp
my simple use case is I pass a date and try to compare that with the default createdAt column. and my date is a string like this date = ‘2018-12-12’ The problem here is sequlize not compare only the date. But it does add time 00:00:00 to my date and then compare. So the query sequlize generate is …
TypeError: data.forEach is not a function
This is my code: I get the error that for each does not work on the data variable. However, when I log data to the console, I get [{“model”: “app.mdl”, “pk”: 1, “fields”: {“name”: “test”, “rank”: 1}}] This is clearly an array …
React + NodeJs Fetch issue
I am trying to fetch the following results of my api (which is working well) http://localhost:5000/api/continents into a react component (a simple array to begin with). Endpoint code extracted from server.js: Here is my continents.js code: And here is the App.js code: Issue: continents array is empty. No data…
JavaScript – Event listener with window.matchMedia not triggering
I’ve panned through countless solutions to this problem and none of them have fixed my issue. I very simply have a navigation bar, which, when on a mobile browser, disappears and becomes replaced with a button, whose function is to show and hide the navigation bar. Now, I want my listener to, when the w…
Is it possible to pass a function from html into a lit-element?
I have seen examples of passing a function from a parent lit-element to a child one like here – https://medium.com/@westbrook/litelement-to-do-app-1e08a31707a4 But I want the users of my element, not to be forced to create a wrapper element to use my element. For example, my element is a dialog that com…
Make React useEffect hook not run on initial render
According to the docs: componentDidUpdate() is invoked immediately after updating occurs. This method is not called for the initial render. We can use the new useEffect() hook to simulate componentDidUpdate(), but it seems like useEffect() is being ran after every render, even the first time. How do I get it …