diff --git a/.gitignore b/.gitignore index da23d0d..106ffc1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,26 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# Deployed apps should consider commenting this line out: -# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git -node_modules +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Deployed apps should consider commenting this line out: +# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +node_modules +.idea/ diff --git a/README.md b/README.md index 595fdd3..5d1b571 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,12 @@ npm install hammer-touchemulator ``` ## How to use -Include the javascript file, and call the `Emulator()` function before any other libraries that do something with the +Include the javascript file, and call `TouchEmulator.start()` before any other libraries that do something with the touch input. It will set some fake properties to spoof the touch detection of some libraries, and triggers `touchstart`, `touchmove` and `touchend` events on the mouse target. ````html - + ```` ````js @@ -42,6 +42,9 @@ document.body.addEventListener('touchend', log, false); Also, the script includes polyfills for `document.createTouch` and `document.createTouchList`. +You can stop the touch emulator with `TouchEmulator.stop()` and restart it with another call to `TouchEmulator.start()`. +In previous versions, the emulator was started by calling `TouchEmulator()`; that continues to work, too. + ## How it works It listens to the `mousedown`, `mousemove` and `mouseup` events, and translates them to touch events. If the mouseevent has the `shiftKey` property to `true`, it enables multi-touch. diff --git a/tests/manual/events-restarted.html b/tests/manual/events-restarted.html new file mode 100644 index 0000000..397e9d4 --- /dev/null +++ b/tests/manual/events-restarted.html @@ -0,0 +1,37 @@ + + +
+ +