1. 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" />
Copyright © tuzhu008 2017 all right reserved,powered by Gitbook该文件修订时间: 2017-11-23 13:48:15

results matching ""

    No results matching ""