Skip to content

Commit

Permalink
Readme updates, dependency update, minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nodonisko committed Oct 11, 2016
1 parent 787fb55 commit 75415c9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Key features:
+ Don't invalidate cache if is browser offline
+ Set and invalidate groups of entries

TO DO:
+ Add cordova-sqlite-storage plugin support again

Please report all bugs to bug report or fix it, or better fix it and send pull request :)

#### Contributors
Expand All @@ -21,11 +24,28 @@ Via NPM:

```bash
npm install ionic-cache --save
cordova plugin add cordova-sqlite-storage --save
```

And inject service to your app:

*app.module.ts*

```ts
import {CacheService} from "ionic-cache/ionic-cache";

@NgModule({
...
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage
],
providers: [CacheService],
})
```

*app.component.ts*

```ts
import {CacheService} from "ionic-cache/ionic-cache";

Expand All @@ -40,9 +60,6 @@ class MyApp {
}
...
}
ionicBootstrap(MyApp, [
CacheService
]);
```

## Usage
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ionic-cache",
"version": "1.0.9",
"version": "1.1.0",
"description": "Ionic cache service - cache request, data, promises etc.",
"main": "ionic-cache.js",
"scripts": {
Expand All @@ -23,14 +23,17 @@
},
"homepage": "https://github.com/Nodonisko/ionic-cache#readme",
"dependencies": {
"@angular/core": "^2.0.0-rc.4",
"rxjs": "^5.0.0-beta.6"
"@angular/core": "^2.0.2",
"@angular/http": "^2.0.2",
"@angular/platform-browser": "^2.0.2",
"rxjs": "^5.0.0-beta.12",
"zone.js": "^0.6.21"
},
"devDependencies": {
"tslint": "^3.13.0",
"tslint-ionic-rules": "^0.0.3",
"typescript": "^1.8.10",
"typings": "^1.3.1"
"tslint": "^3.15.1",
"tslint-ionic-rules": "^0.0.6",
"typescript": "^2.0.3",
"typings": "^1.4.0"
},
"typings": "./ionic-cache.d.ts"
}
3 changes: 0 additions & 3 deletions src/cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export class CacheService {
private networkStatus: boolean = true;

constructor() {
console.log('constructor');
try {
this.storage = new SqlStorage();
this.watchNetworkInit();
Expand Down Expand Up @@ -128,8 +127,6 @@ export class CacheService {

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

console.log(query);

return this.storage.query(query).then(() => data);
}

Expand Down
4 changes: 4 additions & 0 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export class SqlStorage {
this.database = window.openDatabase('cache', '1.0', 'cache', 5 * 1024 * 1024);
}

/**
* @description Call database query
* @return {Promise<any>}
*/
public query(query: String): Promise<any> {
return new Promise((resolve, reject) => {
this.database.transaction((tx) => {
Expand Down

0 comments on commit 75415c9

Please sign in to comment.