-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (23 loc) · 901 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* eslint-env node */
'use strict';
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
const map = require('broccoli-stew').map;
module.exports = {
name: '@gavant/ember-websockets',
treeForVendor() {
let defaultTree = this._super.treeForVendor.apply(this, arguments);
let vendorTree = new Funnel(defaultTree, {
destDir: 'websockets',
files: ['sock.js', 'stomp.js']
});
vendorTree = map(vendorTree, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`);
return new mergeTrees([defaultTree, vendorTree]);
},
included(app) {
this._super.included.apply(this, arguments);
// these files will be loaded in FastBoot but will not be eval'd
app.import('vendor/websockets/sock.js');
app.import('vendor/websockets/stomp.js');
}
};