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

Fixing two recognize-gesture deprecation messages #137

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ env:
matrix:
# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.12
- EMBER_TRY_SCENARIO=ember-lts-2.16
- EMBER_TRY_SCENARIO=ember-lts-2.18
- EMBER_TRY_SCENARIO=ember-lts-3.8
- EMBER_TRY_SCENARIO=ember-lts-3.12
- EMBER_TRY_SCENARIO=ember-lts-3.16
- EMBER_TRY_SCENARIO=ember-lts-3.20
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
Expand Down
38 changes: 21 additions & 17 deletions addon/modifiers/recognize-gesture.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import Modifier from 'ember-class-based-modifier';
import Modifier from 'ember-modifier';
import { getOwner } from '@ember/application';

export default class RecognizeGestureModifier extends Modifier {
Expand All @@ -9,30 +9,34 @@ export default class RecognizeGestureModifier extends Modifier {
this.recognizers = null;
this.manager = null;
this.gestures = getOwner(this).lookup('service:-gestures');

if (this.args.positional) {
this.recognizers = this.gestures.retrieve(this.args.positional);
}
this.gestureNames = this.args.positional;
this.managerOptions = (this.args.named && (Object.keys(this.args.named).length > 0)) ? Object.assign({}, this.args.named) : { domEvents: true };
this.managerOptions.useCapture = this.gestures.useCapture;

}

didInstall() {
if (!this.recognizers) return;
this.element.style['touch-action'] = 'manipulation';
this.element.style['-ms-touch-action'] = 'manipulation';
this.recognizers.then ( (recognizers) => {
if (this.isDestroyed) return;
this.sortRecognizers(recognizers);
this.manager = new Hammer.Manager(this.element, this.managerOptions);
recognizers.forEach((recognizer) => { this.manager.add(recognizer); });
});
if (this.args.positional) {
Promise.resolve().then( () => {
this.recognizers = this.gestures.retrieve(this.gestureNames);
if (this.recognizers) {
this.element.style['touch-action'] = 'manipulation';
this.element.style['-ms-touch-action'] = 'manipulation';
this.recognizers.then ( (recognizers) => {
if (this.isDestroyed) return;
this.sortRecognizers(recognizers);
this.manager = new Hammer.Manager(this.element, this.managerOptions);
recognizers.forEach((recognizer) => { this.manager.add(recognizer); });
});
}
});
}
}

willRemove() {
this.manager.destroy();
this.manager = null;
if (this.manager !== null) {
this.manager.destroy();
this.manager = null;
}
}

// Move each recognizer after all recognizers it excludes in the list - why?
Expand Down
16 changes: 16 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ module.exports = function() {
}
}
},
{
name: 'ember-lts-3.16',
npm: {
devDependencies: {
'ember-source': '~3.16.0'
}
}
},
{
name: 'ember-lts-3.20',
npm: {
devDependencies: {
'ember-source': '~3.20.0'
}
}
},
{
name: 'ember-release',
npm: {
Expand Down
1 change: 1 addition & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"animation-frame": "~0.2.4",
"broccoli-funnel": "^2.0.2",
"broccoli-merge-trees": "^3.0.2",
"ember-class-based-modifier": "^0.10.0",
"ember-modifier": "^2.1.1",
"ember-cli-babel": "^7.7.0",
"ember-cli-htmlbars": "^2.0.1",
"ember-cli-version-checker": "^2.1.0",
Expand Down Expand Up @@ -73,7 +73,7 @@
"ember-on-modifier": "1.0.0",
"ember-qunit": "^4.5.1",
"ember-resolver": "^4.0.0",
"ember-source": "~3.1.0",
"ember-source": "~3.3.0",
"ember-source-channel-url": "^1.0.1",
"ember-try": "^0.2.23",
"eslint-plugin-ember": "^5.0.0",
Expand Down
Loading