Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4834

Pre-boot JavaScript

$
0
0

@jamesarosen wrote:

I'm looking for a pattern for code that should run before Ember boots. I'm thinking of things like initializing tracking libraries and checking browser compatibility.

ember-cli-google-analytics injects an inline <script> into <head>. I don't love that because it violates Content-Security-Policy (unless you generate a cryptographic hash of the inline script contents and add that to the CSP definition).

Another option would be putting the code in app/initializers/. I don't love that (at least for the browser-compatibility detection) because the browser may never get to initializers.

I'm considering adding a pre-boot/ directory that gets appended to app.js without being wrapped in require.define blocks so it executes immediately.

Does anyone have a pattern they really like?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4834

Trending Articles