Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-cli-pace

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-pace - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

vendor/ember-cli-pace/script-loader.js

81

index.js

@@ -6,9 +6,35 @@ /* jshint node: true */

var path = require('path');
var UglifyJS = require("uglify-js");
var _pacePath, _paceConfig;
var _paceConfig = {};
var _defaultPaceConfig = {
color: 'blue',
theme: 'minimal'
theme: 'material',
catchupTime: 50,
initialRate: .01,
minTime: 100,
ghostTime: 50,
maxProgressPerFrame: 20,
easeFactor: 1.25,
startOnPageLoad: true,
restartOnPushState: true,
restartOnRequestAfter: 500,
target: 'body',
elements: {
checkInterval: 100,
selectors: ['body', '.ember-view']
},
eventLag: {
minSamples: 10,
sampleCount: 3,
lagThreshold: 3
},
ajax: {
trackMethods: ['GET', 'POST', 'DELETE', 'OPTIONS'],
trackWebSockets: true,
ignoreURLs: []
}
};
module.exports = {

@@ -19,10 +45,13 @@ name: 'ember-cli-pace',

if ('pace' in baseConfig) {
_paceConfig = baseConfig.pace;
if (!baseConfig.pace) {
_paceConfig = false;
} else {
Object.keys(_defaultPaceConfig).forEach(function (key) {
_paceConfig[key] = baseConfig.pace[key] || _defaultPaceConfig[key];
});
}
} else {
_paceConfig = {};
_paceConfig = _defaultPaceConfig;
}
_paceConfig.color = _paceConfig.color || _defaultPaceConfig.color;
_paceConfig.theme = _paceConfig.theme || _defaultPaceConfig.theme;
if (environment === 'development') {

@@ -36,2 +65,6 @@ return {

}
return {
pace: _paceConfig
};
},

@@ -42,7 +75,14 @@

_pacePath = path.join(app.bowerDirectory, 'pace');
if (_paceConfig) {
var paceThemeName = path.join(_paceConfig.color, 'pace-theme-' + _paceConfig.theme + '.css'),
originalPaceThemePath = path.join(this.app.bowerDirectory, 'pace', 'themes', paceThemeName),
addonPaceThemePath = path.join('vendor', 'ember-cli-pace', 'themes', paceThemeName);
if (_paceConfig) {
var themePath = path.join(_pacePath, 'themes', _paceConfig.color, 'pace-theme-' + _paceConfig.theme + '.css');
app.import(themePath);
if (fs.existsSync(originalPaceThemePath)) {
app.import(originalPaceThemePath);
} else if (fs.existsSync(addonPaceThemePath)) {
app.import(addonPaceThemePath);
} else {
throw new Error('Pace theme CSS file was not found: ' + paceThemeName);
}
}

@@ -52,11 +92,18 @@ },

contentFor: function (name) {
if (name === 'head') {
var paceScriptPath = path.join(_pacePath, 'pace.min.js'),
addonScriptPath = path.resolve(__dirname, 'addon', 'script-loader.js'),
paceScript = fs.readFileSync(paceScriptPath, 'utf8'),
addonScript = fs.readFileSync(addonScriptPath, 'utf8');
if (_paceConfig && name === 'head') {
var paceScriptPath = path.join(this.app.bowerDirectory, 'pace', 'pace.js'),
addonScriptPath = path.resolve('vendor', 'ember-cli-pace', 'script-loader.js'),
paceScript, addonScript;
return '<script type="text/javascript">' + paceScript + ';\n' + addonScript + '</script>';
if (this.app.env === 'production') {
paceScript = UglifyJS.minify(paceScriptPath).code;
addonScript = UglifyJS.minify(addonScriptPath).code;
} else {
paceScript = fs.readFileSync(paceScriptPath, 'utf8');
addonScript = fs.readFileSync(addonScriptPath, 'utf8');
}
return '<script type="text/javascript" data-pace-options=\'' + JSON.stringify(_paceConfig) + '\'>' + paceScript + ';\n' + addonScript + '</script>';
}
}
};
{
"name": "ember-cli-pace",
"version": "0.0.8",
"version": "0.0.9",
"description": "Pace.js load progress bar for Ember apps, incl. Flash-like initial script lazy loading",

@@ -27,3 +27,2 @@ "directories": {

"ember-cli-app-version": "0.3.3",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "0.0.8",

@@ -35,4 +34,5 @@ "ember-cli-htmlbars": "0.7.4",

"ember-cli-uglify": "1.0.1",
"ember-disable-prototype-extensions": "^1.0.0",
"ember-export-application-global": "^1.0.2",
"ember-disable-prototype-extensions": "^1.0.0"
"uglify-js": "^2.4.19"
},

@@ -39,0 +39,0 @@ "keywords": [

@@ -5,3 +5,3 @@ # [Pace.js](http://github.hubspot.com/pace/docs/welcome/) load progress bar for Ember apps, incl. initial scripts lazy loading

### [Demo](http://vectart.github.io/ember-cli-pace/)
# [Demo](http://vectart.github.io/ember-cli-pace/)

@@ -29,13 +29,35 @@ ## Installation

## Themes
## Configuration
Pace.js provides [14 progress bar themes](https://github.com/HubSpot/pace/tree/master/themes/black) in [10 colors](https://github.com/HubSpot/pace/tree/master/themes). See the progress bars and spinners in action: http://github.hubspot.com/pace/docs/welcome/
All options, excluding addon-related `color` and `theme`, are documented on [http://github.hubspot.com/pace/](http://github.hubspot.com/pace/#configuration).
To configure theme, append few lines to `config/environment.js`:
```javascript
var ENV = {
pace: {
color: 'red', // default: blue
theme: 'big-counter' // default: minimal
color: 'blue',
theme: 'material',
catchupTime: 50,
initialRate: .01,
minTime: 100,
ghostTime: 50,
maxProgressPerFrame: 20,
easeFactor: 1.25,
startOnPageLoad: true,
restartOnPushState: true,
restartOnRequestAfter: 500,
target: 'body',
elements: {
checkInterval: 100,
selectors: ['body', '.ember-view']
},
eventLag: {
minSamples: 10,
sampleCount: 3,
lagThreshold: 3
},
ajax: {
trackMethods: ['GET', 'POST', 'DELETE', 'OPTIONS'],
trackWebSockets: true,
ignoreURLs: []
}
}

@@ -45,8 +67,13 @@ };

## Themes
This addon is bundled with Material spinner theme, which is set by default. See it on [demo page](http://vectart.github.io/ember-cli-pace/).
Pace.js originally provides [14 progress bar themes](https://github.com/HubSpot/pace/tree/master/themes/black) in [10 colors](https://github.com/HubSpot/pace/tree/master/themes). See the progress bars and spinners in action: http://github.hubspot.com/pace/docs/welcome/
![Pace.js themes](https://www.dropbox.com/s/d4ladjwfrqq6ehv/Screenshot%202015-04-07%2011.54.48.png?dl=1)
## Pace API
More details on Pace API and configuration could be found on [http://github.hubspot.com/pace/](http://github.hubspot.com/pace/)
More details on Pace events, methods and configuration could be found on http://github.hubspot.com/pace/

@@ -53,0 +80,0 @@ ## Developing ember-cli-pace

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc