pwa 0.1.8

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 93

Progressive Web App (PWA) for Dart

Progressive web apps (PWA) are a hybrid of regular web pages (or websites) and a mobile application. This new application model attempts to combine features offered by most modern browsers with the benefits of mobile experience.

Warning: the API is experimental, and subject to change.

Background

PWA is using ServiceWorkers:

Learn more about PWAs:

Articles about this packages:

Tutorial and Examples

Getting started

  • Getting started: pwa_defaults

    • Shows you how to use the pwa package and what it does.
    • Enables offline asset caching for you web app out-of-the-box.
  • Additional offline urls: additional_offline_urls

    • Show you how to create the entry point for customization.
    • Gives you the ability to add additional URLs for the offline cache.

Customize caching

  • Custom routes: custom_routes
    • Familiarize yourself with caching and routes.
    • Customize cache behavior for different parts of your app.

Push notification

  • Push notification: push_notification
    • Check and/or request Push permission.
    • Trigger and handle push event, show notification.

Planned features

  • Typed Window <-> Worker communication, both Streams and request-reply patterns, something like:

    typedef Future<S> AsyncFunction<R, S>(R request);
    typedef S WireAdapter<R, S>(R input);
    
    abstract class MessageHub {
    
      AsyncFunction<R, S> getFunction<R, S>(String type,
          {WireAdapter<R, dynamic> encoder, WireAdapter<dynamic, S> decoder});
    
      void setHandler<R, S>(String type, AsyncFunction<R, S> handler,
          {WireAdapter<dynamic, R> decoder, WireAdapter<S, dynamic> encoder});
    
      Sink<T> getSink<T>(String type, {WireAdapter<T, dynamic> encoder});
    
      Stream<T> getStream<T>(String type, {WireAdapter<dynamic, T> decoder});
    }
    
  • Push Notification

    • notification for the client app
    • one-method registration and/or status request

Changelog

0.1.8

  • Better pub.exe detection on Windows.
  • Do not abort if project build fails.

0.1.7

  • Generate manifest.json.

0.1.6

  • Do not include .scss files in generated offline URLs.

0.1.5

  • Console logging to uncover install/activation issues. That also causes a behavior change: errors during install won't interrupt the setup of the SW.
  • Updated code generator:
    • Breaking change: --lib-dir will refer to the lib directory of the project, while its previous purpose will be handled by --pwa-lib-dir. Most users won't be affected (when using the defaults).
    • Invoke pub build not only on empty build/ directory, but also when changes were detected.

0.1.4

  • Expose clientKeys in PushPermission.

0.1.3

  • Workaround for a bug in Chrome: ServiceWorkerContainer.ready may not complete in certain cases (for no apparent reason). Added a timeout of two seconds and return the registered SW instance.

  • Added higher-level API helpers for checking Push permission and handling push events.

0.1.2

  • Filter offline URLs:
    • dart2js debug outputs (.dart.info.json)
    • package:test and package:package_resolver assets

0.1.1

  • Generating lastModified timestamp (in String) for offline URLs.
  • Encouraging (but not yet enforcing) to use a version String in Worker.run().
  • The generated pwa.dart uses offline.lastModified as the version.

0.1.0

Breaking changes:

  • Remove deprecated methods and classes (see changes in version 0.0.5).

  • Changed the initialization of the Service Worker:

    • pwa.g.dart -> pwa.dart (source code generation is one-time only)
    • Client unregisters old version (ANY ServiceWorker ending with /pwa.g.dart.js)
  • Worker.onInstall and Worker.onActicate became fields (instead of being methods).

0.0.5

API refactoring:

  • Remove Pwa class name prefix (not immediately breaking, added deprecated notes)

    • PwaClient -> Client
    • PwaWorker -> Worker
    • PwaCacheMixin -> FetchStrategy
  • Renamed ambiguous items related to the Fetch API (not immediately breaking, added deprecated notes)

    • Handler -> RequestHandler
    • Matcher -> RequestMatcher
    • Router -> FetchRouter
    • defaultFetchHandler -> defaultRequestHandler
    • noCacheNetworkFetch -> noCacheNetworkRequestHandler
  • Renamed DynamicCache's noNetworkCaching -> skipDiskCache (not immediately breaking, added deprecated notes).

  • Updated methods in FetchRouter (not immediately breaking, added deprecated notes)

    • add -> registerMatcher
    • new method: registerUrl (will make urlPrefixMatcher internal)
    • get -> registerGetUrl
    • post -> registerPostUrl

0.0.4

  • Fix path separators on Windows.
  • Updated examples:
    • Added pwa_defaults.
    • Moved example into examples/custom_routes.
  • Execute pub build when the project has no build/web directory yet.

0.0.3

Breaking changes:

  • (API) BlockCache and DynamicCache don't expose their initialization parameters. This is a minor change, it is unlikely to affect anybody.

  • (behavior) BlockCache and DynamicCache use path-specific cache prefixes, in order to prevent collision between apps that are installed on the same domain.

    This fixes unintended cache collisions, but also breaks if you were building on sharing the caches between apps. In this case, use the new prefix optional argument when instantiating caches.

    If you have used only a single application in the root of the domain, you are not affected by this change.

0.0.2

  • Fix default codegen.
  • Call skipWaiting() by default (can be disabled through flag).
  • The generated offline URLs and the SW registration is changed to relative URLS, we can put the application in any directory.
  • DynamicCache evicts older entries first (previously it was random).
  • DynamicCache doesn't evicts old entries on initialization, which enables offline-aware caches to outlive the set expiration until the next successful network event.
  • Support for caching common web fonts.

0.0.1

Experimental release, looking for feedback.

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pwa: "^0.1.8"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pwa/client.dart';

import 'package:pwa/worker.dart';
        
Version Uploaded Documentation Archive
0.1.8 Nov 24, 2017 Go to the documentation of pwa 0.1.8 Download pwa 0.1.8 archive
0.1.7 May 15, 2017 Go to the documentation of pwa 0.1.7 Download pwa 0.1.7 archive
0.1.6 May 12, 2017 Go to the documentation of pwa 0.1.6 Download pwa 0.1.6 archive
0.1.5 May 11, 2017 Go to the documentation of pwa 0.1.5 Download pwa 0.1.5 archive
0.1.4 Apr 26, 2017 Go to the documentation of pwa 0.1.4 Download pwa 0.1.4 archive
0.1.3 Apr 5, 2017 Go to the documentation of pwa 0.1.3 Download pwa 0.1.3 archive
0.1.2 Mar 22, 2017 Go to the documentation of pwa 0.1.2 Download pwa 0.1.2 archive
0.1.1 Mar 22, 2017 Go to the documentation of pwa 0.1.1 Download pwa 0.1.1 archive
0.1.0 Mar 20, 2017 Go to the documentation of pwa 0.1.0 Download pwa 0.1.0 archive
0.0.5 Mar 16, 2017 Go to the documentation of pwa 0.0.5 Download pwa 0.0.5 archive

All 14 versions...

Analysis

This feature is new.
We welcome feedback.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Dec 6, 2017
  • Dart: 2.0.0-dev.8.0
  • pana: 0.7.3+1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
86
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
99
Overall score:
Weighted score of the above. [more]
93

Platforms

Detected platforms: web

All libraries agree

Dependencies

Package Constraint Resolved Available
Direct dependencies
args >=0.13.7 <1.0.0 0.13.7 1.2.0
dart_style >=0.2.16 <1.1.0 1.0.8
func >=0.1.1 <1.1.0 1.0.0
glob ^1.1.3 1.1.5
service_worker ^0.1.0 0.1.0
yaml ^2.1.12 2.1.13
Transitive dependencies
analyzer 0.30.0+4 0.31.0-alpha.2
async 2.0.1
charcode 1.1.1
cli_util 0.1.2+1
collection 1.14.3
convert 2.0.1
crypto 2.0.2+1
csslib 0.14.1
front_end 0.1.0-alpha.4.1 0.1.0-alpha.7
html 0.13.2
isolate 1.1.0
js 0.6.1
kernel 0.3.0-alpha.1.1 0.3.0-alpha.4
logging 0.11.3+1
meta 1.1.2
package_config 1.0.3
path 1.5.1
plugin 0.2.0+2
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+3
watcher 0.9.7+4