Skip to content

Commit 75415c9

Browse files
committed
Readme updates, dependency update, minor fixes
1 parent 787fb55 commit 75415c9

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

README.md

+21-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Key features:
99
+ Don't invalidate cache if is browser offline
1010
+ Set and invalidate groups of entries
1111

12+
TO DO:
13+
+ Add cordova-sqlite-storage plugin support again
14+
1215
Please report all bugs to bug report or fix it, or better fix it and send pull request :)
1316

1417
#### Contributors
@@ -21,11 +24,28 @@ Via NPM:
2124

2225
```bash
2326
npm install ionic-cache --save
24-
cordova plugin add cordova-sqlite-storage --save
2527
```
2628

2729
And inject service to your app:
2830

31+
*app.module.ts*
32+
33+
```ts
34+
import {CacheService} from "ionic-cache/ionic-cache";
35+
36+
@NgModule({
37+
...
38+
bootstrap: [IonicApp],
39+
entryComponents: [
40+
MyApp,
41+
AboutPage
42+
],
43+
providers: [CacheService],
44+
})
45+
```
46+
47+
*app.component.ts*
48+
2949
```ts
3050
import {CacheService} from "ionic-cache/ionic-cache";
3151

@@ -40,9 +60,6 @@ class MyApp {
4060
}
4161
...
4262
}
43-
ionicBootstrap(MyApp, [
44-
CacheService
45-
]);
4663
```
4764

4865
## Usage

package.json

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic-cache",
3-
"version": "1.0.9",
3+
"version": "1.1.0",
44
"description": "Ionic cache service - cache request, data, promises etc.",
55
"main": "ionic-cache.js",
66
"scripts": {
@@ -23,14 +23,17 @@
2323
},
2424
"homepage": "https://github.com/Nodonisko/ionic-cache#readme",
2525
"dependencies": {
26-
"@angular/core": "^2.0.0-rc.4",
27-
"rxjs": "^5.0.0-beta.6"
26+
"@angular/core": "^2.0.2",
27+
"@angular/http": "^2.0.2",
28+
"@angular/platform-browser": "^2.0.2",
29+
"rxjs": "^5.0.0-beta.12",
30+
"zone.js": "^0.6.21"
2831
},
2932
"devDependencies": {
30-
"tslint": "^3.13.0",
31-
"tslint-ionic-rules": "^0.0.3",
32-
"typescript": "^1.8.10",
33-
"typings": "^1.3.1"
33+
"tslint": "^3.15.1",
34+
"tslint-ionic-rules": "^0.0.6",
35+
"typescript": "^2.0.3",
36+
"typings": "^1.4.0"
3437
},
3538
"typings": "./ionic-cache.d.ts"
3639
}

src/cache.service.ts

-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class CacheService {
2323
private networkStatus: boolean = true;
2424

2525
constructor() {
26-
console.log('constructor');
2726
try {
2827
this.storage = new SqlStorage();
2928
this.watchNetworkInit();
@@ -128,8 +127,6 @@ export class CacheService {
128127

129128
let query = `INSERT OR REPLACE INTO ${this.tableName} (${Object.keys(valuesMap).join(', ')}) VALUES (${values.join(', ')})`;
130129

131-
console.log(query);
132-
133130
return this.storage.query(query).then(() => data);
134131
}
135132

src/storage.ts

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ export class SqlStorage {
55
this.database = window.openDatabase('cache', '1.0', 'cache', 5 * 1024 * 1024);
66
}
77

8+
/**
9+
* @description Call database query
10+
* @return {Promise<any>}
11+
*/
812
public query(query: String): Promise<any> {
913
return new Promise((resolve, reject) => {
1014
this.database.transaction((tx) => {

0 commit comments

Comments
 (0)