Im working on a chat app, using firebase and javascript. I encountered a problem, when I switch receivers multiple times, the message that I sent fetches a few times while the messages is sent only once to the database. Here is how it looks when it fetches, after a switch receivers a few times As you can see,…
Tag: javascript
Faster ‘ find & reorder’ logic in javascript
I am reordering the nodes in a certain level for a tree structure using the following recursive function. Reorder using the sort is not taking time, however recursively finding the parent node is taking time. how can I make this faster? tree data reorderedObject If i have 4 level depth and 50 items in each le…
delay JavaScript on input, so function does fire for each character inputted into a search field
I have a search field to allow users to filter the results that are returned from the database. I have it set so that the search field has a .on(‘input’, function() { which will trigger another function. This poses a problem in which if a user was to search for “crumble” the ajax reque…
How get data stored in vars from a js file in python
I have a js file that I need to get data out of but I am not sure how to get the data out in the way I want. I would like it to be readable and subscriptable like a python dict(like dict[“key/value”]). just opening the file returns an <class ‘_io.TextIOWrapper’> but that doesn…
How to make a pure-CSS animation of CLOCKWISE rotation past 359 degrees
I’m having an issue with pure CSS-based rotation using transform: rotate() coupled with transition: transform. When rotating past 360 degrees, the transition causes a counter-clockwise rotation. See code below or on CodePen. I know I can just keep increasing/decreasing the degree value (e.g. 356->360…
How can I map over an object and set it to another object without overwriting the previous values?
I’m working with a form that has sections where there can be multiple addresses, ids, etc. I’m taking the value of those objects and mapping it to another object that my API can understand. The problem I’m having is that when I have more than two addresses or ids my function overwrites all t…
how to implement angular table with reactive form
based on my html below , as you can see I have a table and then looped through mat cell using *matCellDef=”let model” , inside the cell there are input fields which are reactive forms (it has mat error checking ,formcontrolname etc). Each cell or row should have its own reactive form since each ro…
Find how many times a char is included into an array of names
I’m trying to do the following exercise in JavaScript: I need to return the number of times the letter ‘l’ is used inside an array of names. This is an example of the array I have to use: Note that the letter ‘l’ might be repeted inside a single name. Is there any JS method I cou…
setTime() replacement in php [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 months ago. Improve this question I want to convert below javascript code to PHP returning value Wed Jan 12 2022 07:03:22 GMT…
es6 modules: import specific-functions as aName
I’d like to import specific functions from another module. But I faced naming collision: I have similar function names in my importing file. I’d like to do something like this: I know I could import * as exporter from “exporterFile.js” but it lacks readability and does not show what me…