Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
broccoli-serviceworker
Advanced tools
A broccoli plugin automating ServiceWorker file creation for Broccoli and Ember.js
ServiceWorker generator for Broccoli and Ember.js. Derived from broccoli-manifest.
For more details on ServiceWorker check out the following:
npm install --save-dev broccoli-serviceworker
//app/config/environment.js
ENV.serviceWorker = {
enabled: true,
serviceWorkerFile: "service-worker.js",
excludePaths: ['tests/', 'online.html',],
includePaths: ['/'],
fallback: [
'/online.html offline.html'
],
dynamicCache: [
'/api/todos'
]
};
Upgrade your index.html
(see below) and you are done.
npm install --save broccoli-serviceworker
Use broccoli-serviceworker
as your last filter in the Brocfile.js
like this
var writeServiceWorker = require('broccoli-serviceworker');
...
var completeTree = mergeTrees([appJs, appCss, publicFiles]);
module.exports = mergeTrees([completeTree, writeServiceWorker((completeTree)]);
You can pass some options as the second argument to writeServiceWorker
:
writeServiceWorker(completeTree, {
serviceWorkerFile: "service-worker.js",
excludePaths: ['tests/', 'online.html',],
includePaths: ['/'],
fallback: [
'/online.html offline.html'
],
dynamicCache: [
'/api/todos'
]
});
Files can be filtered using regular expressions.
{
excludePaths: ['index.html', new RegExp(/.\.map$/)],
includePaths: ['']
}
In order to use the generated serviceworker, you will need to register the serviceworker. You can do so with the following code:
<!DOCTYPE html>
<html>
...
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js', {scope: './'})
.catch(function(error) {
alert('Error registering service worker:'+error);
});
} else {
alert('service worker not supported');
}
</script>
</html>
0.0.1 (2015-06-13)
* This Change Log was automatically generated by github_changelog_generator
FAQs
A broccoli plugin automating ServiceWorker file creation for Broccoli and Ember.js
The npm package broccoli-serviceworker receives a total of 2 weekly downloads. As such, broccoli-serviceworker popularity was classified as not popular.
We found that broccoli-serviceworker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.