Coder Social home page Coder Social logo

naschq / dsw Goto Github PK

View Code? Open in Web Editor NEW
273.0 15.0 12.0 12.45 MB

Dynamic Service Worker - making your offline Progressive Web Apps way easier

License: Other

JavaScript 81.85% HTML 15.23% CSS 2.92%
service-worker notification-api dynamic-service-worker indexeddb offline redirect-requests

dsw's People

Contributors

amilajack avatar artisin avatar felipenmoura avatar ultcombo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dsw's Issues

Support programatic approach

There should be a way for us to require it, and use it programatically, so there could be grunt or gulp tasks, for example.

Add support for WebSockets

There may be an API for connecting and listening for WebSockets.
As well as a way to intercept and use data from websockets (even if the script is not using the DSW api itself).

Add timeout for network requests

We should definitely have a way to define for how long the user will stay waiting for a request before we kill it and deliver something else (like a custom page or default value).

boilerplate directory isn't working

➜  dsw git:(master) git submodule update --init --recursive
No submodule mapping found in .gitmodules for path 'boilerplate'
➜  dsw git:(master)

maybe .gitmodules file is missing?

Docs isn't clear enough on how to run dsw

just run again the dsw command line on your project

I'm following the docs and then suddenly I get the instruction above.
I'm confused because at this step I never used the dsw command yet.

Also, I don't get yet why do we need the dsw globally 😕

Uncaught (in promise) TypeError: Cannot read property 'transaction' of undefined

I followed the documentation and I got this error in the console when I tried to run my index.html file.
I'm missing something?

Looking at the code, the error is related to IndexDB I think:

function getObjectStore(dbName) {
    var mode = arguments.length <= 1 || arguments[1] === undefined ? 'readwrite' : arguments[1];

    var db = dbs[dbName],
        tx = db.transaction(dbName, mode);
    return tx.objectStore(dbName);
}

Incorrect package.json main reference

As of right now its "main": "./lib/dsw.js" however that file is related to the bin processes and the try and start npm scripts not the actual program itself. So when you are importing this library into a project its pulling in lib/dsw.js but it should be pulling in src/main.js.

Readme file typo

There's something wrong in the README file on the Using it section, specifically on the 3rd step.

Add unit tests

It is very important that we can have some unit tests (or perhaps using the lighthouse in an automated way).

Bundle Cache

Feature Request

There should be a way for developers to specify a bundle.
When fetching one url, it could then download and store in cache the "most likely to be used" files in future.

Use case:

When the user fetches the kart page, it could pre-load and cache the scripts, html and styles for the purchase screens as they are probably intending on finish the purchase.

"rules": {
  "purchaseIntension": {
    "match": "/my-kart.html",
    "apply": {
      "bundle": {
        "files": [
          "purchase.js",
          "purchase.css",
          "some-image.png",
          "purchase.html"
        ],
        "expires": "30m"
      }
    }
  }
}

Create Manifest

We could have a script to use with npm that would create the manifest itself, for Progressive Web Apps.

Critical dependency

Line 44 require(finalPath) is a critical dependency. Not a huge issue but it will throw an error if users are using webpack.

Add a Graphic Interface for debugging requests

There should be a panel or tool with some UX for debugging the requests.

We already can use the trace method to get the debugging information:

DSW.trace('.*', function(traceData){
    console.log(traceData);
});

All we need is a better way to show the information, and perhaps to define the traced requests.

Add support for indexedDB

The idea is to have support for defining how to store data (from requests to json files) straightly in the indexedDB, so developers can use and access it.

Look for updates when building

We can use the command npm show dsw version to know if it is running on its latest version, and ask the user to update it, if it is not.

Mapping remote endpoints

Hi there,

Am just reviewing solutions for offline caching, and found your project, it looks great!!

I have a quick question with regards to being able to map local endpoints to remote endpoints with dsw.

For some background, our application needs to source large user assets from remote CDN stores, and was wondering if dsw provides a facility for mapping / caching assets hosted on remote domains. We have done some local testing here, and it seems technically feasible with Service Workers.

An example of what we are imagining would be..

https://local.com/bucket/video.mp4 # virtual local path

to be intercepted and rewritten as...

https://remote/bucket/video.mp4 # rewritten endpoint

where dsw would source the remote asset (via CDN) and cache the response against the virtual local path. Was looking for a configuration perhaps similar to the following.

mappings: {
   local: "/bucket",
  remote: "https://remote/bucket/"
}

Again, the DSW solution looks fantastic! Look forward to hearing back.

S

Add support for tracing request

We should be able to know exactly what was the life cycle from a request.
It should tell us the rules and steps it took to get the final result.
Also, a panel for that on the page would be pretty useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.