Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 672 Bytes

typescript.md

File metadata and controls

25 lines (20 loc) · 672 Bytes

TypeScript


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" />