question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to import hammer without using `<script>` tag

See original GitHub issue

I’m using vanilla JS es6 (2015) and I’m trying to import hammer. I can’t seem to find any documentation on how to use these modules instead of using the <script> tag. Is there any way to do this or is the <script> tag the only way?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

18reactions
looeeecommented, Mar 1, 2017

Just in case anybody else finds this - actually you can use Hammer as an ES6 module.

If it’s installed via NPM, use:

import * as Hammer from 'hammerjs';
window.Hammer = Hammer.default;

Thereafter, from the same file you can use Hammer as window.Hammer, and in other files you can just use Hammer.

15reactions
agnivadecommented, May 2, 2017

I am using Angular2, and for me

import 'hammerjs';

worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hammer.js with plain javascript - Stack Overflow
Bind hammer to a container element: var hammer = new Hammer(document.getElementById("container"));. Now, on every gesture that is performed ...
Read more >
Getting Started - Hammer.js
Hammer is a open-source library that can recognize gestures made by touch, mouse and pointerEvents. It doesn't have any dependencies, and it's small, ......
Read more >
Drag with Hammer.js example - CodePen
Drag an item around with Hammer.js Forked from [Jorik Tangelder](http://codepen.io/jtangelder/)'s Pen [Basic Hammer.js example](http://codepen.io/jta...
Read more >
How to use the hammerjs.Pinch function in hammerjs - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues ... import Animate from 'rc-animate'; import...
Read more >
I don't know how to use hammer.js to transition my slides
I'm using the slideshow code from here, https://www.w3schools.com/howto/howto_js_slideshow.asp , and want to use hammer.js here, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found