You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# offline-persistence-toolkit 1.4.1 #
1
+
# offline-persistence-toolkit 1.4.2 #
2
2
3
3
offline-persistence-toolkit is a client-side JavaScript library that provides caching and offline support at the HTTP request layer. This support is transparent to the user and is done through the Fetch API and an XHR adapter. HTTP requests made while the client device is offline are captured for replay when connection to the server is restored. Additional capabilities include a persistent storage layer, synchronization manager, binary data support and various configuration APIs for customizing the default behavior. This framework can be used in both ServiceWorker and non-ServiceWorker contexts within web and hybrid mobile apps.
4
4
@@ -10,11 +10,11 @@ There are various approaches to addressing this issue, most of which involve cac
10
10
11
11
- Caching resources via the [HTML5 application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache"HTML5 application cache"). This feature is now deprecated.
12
12
- Caching resources via the [HTML5 Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"HTML5 Service Workers"). This Service Worker API is an excellent addition to the web platform that will help application developers address a range of connectivity requirements. However, this feature is [not available](http://caniuse.com/#feat=serviceworkers"not available") in some browsers (Safari, IE) and is still under development in others (Edge).
13
-
- Application-specific managing of persistent storage. Applications have access to a range of local storage APIs, including those directly provided by the browsers ([localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage"localStorage"), [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API"IndexedDB")), along with various third party storage libraries (e.g. [PouchDB](https://pouchdb.com/"PouchDB")). Industrious application developers can leverage these APIs to meet their caching needs, though this is typically a tedious manual exercise.
13
+
- Application-specific managing of persistent storage. Applications have access to a range of local storage APIs, including those directly provided by the browsers ([localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage"localStorage"), [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API"IndexedDB")), along with various third party storage libraries (e.g. [PouchDB](https://pouchdb.com/"PouchDB")). Industrious application developers can leverage these APIs to meet their caching needs, though this is typically a tedious manual exercise.
14
14
15
15
The Offline Persistence Toolkit simplifies life for application developers by providing a response caching solution that works well across modern browsers. The toolkit covers common caching cases with a minimal amount of application-specific coding, but provides flexibility to cover non-trivial cases as well. In addition to providing the ability to cache complete response payloads, the toolkit supports "shredding" of REST response payloads into objects that can be stored, queried and updated on the client while offline.
16
16
17
-
The following sections provide an introduction to the Offline Persistence Toolkit.
17
+
The following sections provide an introduction to the Offline Persistence Toolkit.
18
18
19
19
After reading this document, you can find more information about how to implement a range of common and advanced use cases with the toolkit in the [Usage guide](https://github.com/oracle/offline-persistence-toolkit/blob/master/USAGE.md"Usage").
20
20
@@ -53,23 +53,23 @@ copyCustomLibsToStaging: {
53
53
```
54
54
55
55
56
-
If your app uses [RequireJS](http://www.requirejs.org/"RequireJS"), update the library configuration paths to reference the toolkit. To do this, open `appDir/src/js/main.js` and edit `requirejs.config()`, as illustrated by the following example.
56
+
If your app uses [RequireJS](http://www.requirejs.org/"RequireJS"), update the library configuration paths to reference the toolkit. To do this, open `appDir/src/js/main.js` and edit `requirejs.config()`, as illustrated by the following example.
57
57
58
58
```javascript
59
59
requirejs.config({
60
60
paths: {
61
-
'persist':'js/libs/persist/v1.4.1/min'
61
+
'persist':'js/libs/persist/v1.4.2/min'
62
62
63
63
// Other path mappings here
64
64
}
65
65
```
66
-
For Oracle JET apps, also open `appDir/src/js/main-release-paths.json` and add the `'persist':'js/libs/persist/v1.4.1/min'` entry to the list of paths.
66
+
For Oracle JET apps, also open `appDir/src/js/main-release-paths.json` and add the `'persist':'js/libs/persist/v1.4.2/min'` entry to the list of paths.
67
67
68
68
You can choose the name of the paths prefix. That is, you can use a different value to the ‘persist’ value shown in the examples.
69
69
70
-
It is recommended to add the version number as a convention in your application build step such as `'persist':'js/libs/persist/v1.4.1/min'`.
70
+
It is recommended to add the version number as a convention in your application build step such as `'persist':'js/libs/persist/v1.4.2/min'`.
71
71
72
-
Versions of the toolkit are also available on CDN under the latest JET release. e.g.
72
+
Versions of the toolkit are also available on CDN under the latest JET release. e.g.
@@ -83,15 +83,15 @@ The toolkit does not have a dependency on a specific client-side storage solutio
83
83
84
84
npm install pouchdb pouchdb-find
85
85
86
-
And again, if you are using RequireJS, you will need to map paths for these packages, e.g.:
86
+
And again, if you are using RequireJS, you will need to map paths for these packages, e.g.:
87
87
88
88
```javascript
89
89
90
90
requirejs.config({
91
91
paths: {
92
92
'pouchdb':'js/libs/pouchdb-7.0.0',
93
93
'pouchfind':'js/libs/pouchdb.find',
94
-
'persist':'js/libs/persist/v1.4.1/min'
94
+
'persist':'js/libs/persist/v1.4.2/min'
95
95
96
96
// Other path mappings here
97
97
}
@@ -188,10 +188,10 @@ The most trivial use of the DefaultResponseProxy looks like this:
188
188
By default, the fetch event listener produced by the DefaultResponseProxy handles GET requests by first checking see whether the browser/device is online. If the browser is online, the GET request is sent to the endpoint and the response is cached by writing the response payload to local persistence storage. If the browser is offline, the default fetch listener will return a previously cached response, if one is available.
189
189
190
190
This is the simplest form of response caching supported by the Offline Persistence Toolkit. As we will see in later sections, this behavior is configurable, allowing the application to address more interesting use cases.
191
-
192
191
193
192
194
-
193
+
194
+
195
195
196
196
197
197
### What Storage? ###
@@ -235,7 +235,7 @@ require([
235
235
});
236
236
});
237
237
});
238
-
238
+
239
239
240
240
```
241
241
@@ -324,7 +324,7 @@ _handlePost = function (request) {
324
324
// application logic
325
325
});
326
326
};
327
-
var responseProxy =defaultResponseProxy.getResponseProxy({requestHandlerOverride: {handlePost: _handlePost}});
327
+
var responseProxy =defaultResponseProxy.getResponseProxy({requestHandlerOverride: {handlePost: _handlePost}});
328
328
329
329
```
330
330
@@ -333,9 +333,9 @@ A common use case involving POST requests is for the creation of resources. Freq
333
333
```javascript
334
334
// register the listener with sync manager on 'syncRequest' to handle any cleanup.
335
335
// For example, replace client generated id with server generated id
336
-
336
+
337
337
self.afterRequestListener=function(event) {
338
-
var statusCode =event.response.status;
338
+
var statusCode =event.response.status;
339
339
if (statusCode ==200) {
340
340
// sync is successful, do any clean up as needed.
341
341
}
@@ -403,7 +403,7 @@ var responseProxy = defaultResponseProxy.getResponseProxy(
0 commit comments