TypeScript

October 1, 2018 ยท View on GitHub


To simply installing the runtime you can use following snippet:

import * as OfflinePluginRuntime from 'offline-plugin/runtime';
OfflinePluginRuntime.install();

This example shows how to set the install options:

import * as OfflinePluginRuntime from 'offline-plugin/runtime';

OfflinePluginRuntime.install({
  onUpdateReady: () => OfflinePluginRuntime.applyUpdate(),
  onUpdated: () => location.reload(),
});

If you need to resolve the typescript definition file manually then you can add this line to your TypeScript file:

/// <reference path="node_modules/offline-plugin/runtime.d.ts" />