Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this work for 2.0 and {{actions}}? #3

Closed
cbetta opened this issue Dec 14, 2015 · 4 comments
Closed

Does this work for 2.0 and {{actions}}? #3

cbetta opened this issue Dec 14, 2015 · 4 comments

Comments

@cbetta
Copy link

cbetta commented Dec 14, 2015

Does this work for Ember 2.0 and higher? Does this work for ember actions (not just clicks on links)?

@lawitschka
Copy link
Member

Yes, works with Ember 2.x and actions

@cbetta
Copy link
Author

cbetta commented Dec 14, 2015

Ok, still seems slow to me somehow. Any idea how I can confirm if it's working for me correctly?

@lawitschka
Copy link
Member

I just tried it out in the lib's dummy app by adding a button which triggers a route action.

index.hbs

<button type="button" name="button" {{action 'logClick'}}>
  Click me!
</button>

index.js

import Ember from 'ember';

export default Ember.Route.extend({
  actions: {
    logClick() {
      window.console.log('Clicked');
    }
  }
});

Opening the app in Chrome, browsing through the sources, you will find the FastClick library in localhost:4200/assets/bower_components/fastclick/lib/fastclick.js. The method where the magic happens is onTouchEnd(). I just placed a breakpoint in line 606, in the following if block:

// localhost:4200/assets/bower_components/fastclick/lib/fastclick.js
if (!this.needsClick(targetElement)) {
  event.preventDefault();
  this.sendClick(targetElement, event);
}

When activating Emulate touch screen in the Developer Tools, execution stops at the breakpoint. When it is disabled, it does not stop, thus the click event is handled by the browser and not FastClick.

That is the way you can confirm, that it is working. At least, that is, what I just found out. Looked into how to confirm it is working for the first time. Before I luckily could always feel the difference.

@cbetta
Copy link
Author

cbetta commented Dec 14, 2015

Awesome, tnx!

@cbetta cbetta closed this as completed Dec 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants