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

broccoli-serviceworker

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

broccoli-serviceworker - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

lib/registration.js

17

lib/ember-addon.js

@@ -5,2 +5,3 @@ var path = require('path');

var funnel = require('broccoli-funnel');
var stringifile = require('stringifile');

@@ -11,3 +12,3 @@ var serviceWorker = require('./service-worker.js');

name: 'broccoli-serviceworker',
included: function (app) {

@@ -17,3 +18,3 @@ this.app = app;

},
initializeOptions: function () {

@@ -35,6 +36,6 @@ var appOptions = this.app.project.config(this.app.env);

this.serviceWorkerOptions = options;
},
},
postprocessTree: function (type, tree) {
var options = this.serviceWorkerOptions;
var options = this.serviceWorkerOptions;

@@ -51,3 +52,9 @@ if (type === 'all' && options.enabled) {

treeFor: function() {}
treeFor: function() {},
contentFor: function(type, config) {
if (config.environment !== 'test' && type === 'body-footer') {
return stringifile('registration.js', 'script', __dirname);
}
}
};

@@ -15,2 +15,3 @@ var fs = require("fs");

this.addPolyfill = options.addPolyfill || true;
this.skipWaiting = options.skipWaiting || false;
this.debug = options.debug || true;

@@ -30,2 +31,3 @@ this.dynamicCache = options.dynamicCache || [];

var addPolyfill = this.addPolyfill;
var skipWaiting = this.skipWaiting;
var debug = this.debug;

@@ -82,3 +84,3 @@ var dynamicCache = this.dynamicCache;

return;
lines.push(createArrayLine("'"+file+"'", idx, array.length));
lines.push(createArrayLine(" '"+file+"'", idx, array.length));
});

@@ -93,2 +95,7 @@ lines.push("];");

addDebugLine("'Handling install event. Resources to pre-fetch:', urlsToPrefetch", debug, lines);
if (skipWaiting) {
lines.push(" if (self.skipWaiting) { self.skipWaiting(); }");
}
lines.push(" event.waitUntil(");

@@ -95,0 +102,0 @@ lines.push(" caches.open(CURRENT_CACHES['prefetch']).then(function(cache) {");

{
"name": "broccoli-serviceworker",
"version": "0.0.3",
"version": "0.0.4",
"description": "A broccoli plugin automating ServiceWorker file creation for Broccoli and Ember.js",

@@ -29,8 +29,9 @@ "main": "lib/service-worker.js",

"dependencies": {
"broccoli-funnel": "~0.2.3",
"broccoli-kitchen-sink-helpers": "~0.2.2",
"broccoli-merge-trees": "~0.1.4",
"broccoli-funnel": "~1.0.1",
"broccoli-kitchen-sink-helpers": "~0.3.1",
"broccoli-merge-trees": "~1.0.0",
"broccoli-writer": "~0.1.1",
"serviceworker-cache-polyfill": "^3.0.0"
"serviceworker-cache-polyfill": "^3.0.0",
"stringifile": "^0.1.1"
}
}

@@ -34,2 +34,3 @@ broccoli-serviceworker

Upgrade your `index.html` (see below) and you are done.
The service worker bootstrap logic will be added to your index.html automatically, using contentFor hooks.

@@ -69,3 +70,4 @@ Usage for Broccoli.js

'/api/todos'
]
],
skipWaiting: true
});

@@ -87,3 +89,4 @@ ```

In order to use the generated serviceworker, you will need to register the serviceworker. You can do so with the following code:
In order to use the generated serviceworker, you will need to register the serviceworker. This is done automatically if using as an Ember.js addon.
If you're not using Ember.js, you can use the following code:
```HTML

@@ -90,0 +93,0 @@ <!DOCTYPE html>

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