Skip to content

Commit

Permalink
Re-introduce fixes for FastBoot
Browse files Browse the repository at this point in the history
  • Loading branch information
lawitschka committed Sep 10, 2018
1 parent 01b4c16 commit de7f1d8
Show file tree
Hide file tree
Showing 4 changed files with 1,061 additions and 37 deletions.
8 changes: 5 additions & 3 deletions addon/initializers/fastclick.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { schedule } from '@ember/runloop';

export function initialize() {
schedule('afterRender', function() {
FastClick.attach('body');
});
if (typeof FastBoot === 'undefined') {
schedule('afterRender', function() {
FastClick.attach('body');
});
}
}

export default {
Expand Down
22 changes: 21 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
'use strict';

var path = require('path');
var broccoliFunnel = require('broccoli-funnel');
var broccoliMergeTrees = require('broccoli-merge-trees');
var map = require('broccoli-stew').map;

module.exports = {
name: 'ember-cli-fastclick',

included(app) {
this._super.included(app);
app.import('node_modules/fastclick/lib/fastclick.js');
app.import(this.treePaths.vendor + '/fastclick/fastclick.js');
},

treeForVendor(defaultTree) {
var trees = [];
if (defaultTree) {
trees.push(defaultTree);
}
var libPath = path.dirname(require.resolve('fastclick'));
var fastclickLib = new broccoliFunnel(libPath, {
destDir: 'fastclick',
include: ['*']
});
fastclickLib = map(fastclickLib, content => `if (typeof FastBoot === 'undefined') { ${content} }`);
trees.push(fastclickLib);
return broccoliMergeTrees(trees);
}
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"test:all": "ember try:each"
},
"dependencies": {
"broccoli-funnel": "^2.0.1",
"broccoli-merge-trees": "^3.0.1",
"broccoli-stew": "^2.0.0",
"ember-cli-babel": "^6.6.0",
"fastclick": "^1.0.6"
},
Expand All @@ -29,6 +32,7 @@
"ember-cli": "~3.3.0",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-eslint": "^4.2.1",
"ember-cli-fastboot": "^2.0.0",
"ember-cli-htmlbars": "^2.0.1",
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
"ember-cli-inject-live-reload": "^1.4.1",
Expand Down
Loading

0 comments on commit de7f1d8

Please sign in to comment.