Skip to content

Author: admin@master

Simplest way to detect a pinch

This is a WEB APP not a native app. Please no Objective-C NS commands. So I need to detect ‘pinch’ events on iOS. Problem is every plugin or method I see for doing gestures or multi-touch events, is (usually) with jQuery and is a whole additional pluggin for every gesture under the sun. My applica…

JavaScript fileWatcher

I am developing a web application (intranet) and it is mandatory to watch a specific folder, for example c:docs, for inserted files. I would like to do that through JavaScript in order to detect each time the client inserts file into specific directory. Answer You can build your own application using django. …

Javascript event that runs before page changes

Is there such a thing? I know that I can hook my function on the click event of all links, but there are other situations where a page is changed, like refresh or when a different script changes the window.location In the end, I did it by sending a string trough postMessage from the unload event, like this: i…

How to detect radio button deselect event?

Is there an easy way to attach a “deselect” event on a radio button? It seems that the change event only fires when the button is selected. HTML JavaScript jsFiddle ​ Answer Why don’t you simply create a custom event like, lets say, deselect and let it trigger on all the members of the click…

Fast way to get the min/max values among properties of object

I have an object in javascript like this: Is there a fast way to get the minimum and maximum value among the properties without having to loop through them all? because the object I have is huge and I need to get the min/max value every two seconds. (The values of the object keeps changing). Answer There&#821…

Why is process.env.NODE_ENV undefined?

I’m trying to follow a tutorial on NodeJS. I don’t think I missed anything but whenever I call the process.env.NODE_ENV the only value I get back is undefined. According to my research the default value should be development. How is this value dynamically set and where is it set initially? Answer …

Wait until setInterval() is done

I would like to add a small dice-rolling effect to my Javascript code. I think a good way is to use the setInterval() method. My idea was the following code (just for testing): Now I would like to wait for the setInterval until it is done. So I added a setTimeout. This code works quite okay. But in my main