Skip to content

Commit 9d0bfb1

Browse files
committed
fix no listeners for Electron platform
1 parent 421838d commit 9d0bfb1

File tree

4 files changed

+36
-22
lines changed

4 files changed

+36
-22
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 2.0.7 (2021-08-27) CAPACITOR 3 LATEST
2+
3+
### Chore
4+
5+
- update to @capacitor-community/sqlite 3.2.0-6
6+
7+
### Bug Fixes
8+
9+
- Fix not use of Listeners for Electron platform
10+
- Fix readme & changelog
11+
112
## 2.0.6 (2021-08-25) CAPACITOR 3 LATEST
213

314
### Chore

package-lock.json

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"devDependencies": {
3636
"@babel/eslint-parser": "^7.13.14",
37-
"@capacitor-community/sqlite": "3.2.0-5",
37+
"@capacitor-community/sqlite": "^3.2.0-6",
3838
"@capacitor/core": "3.2.0",
3939
"@capacitor/docgen": "0.0.17",
4040
"@types/jest": "^26.0.20",

src/useSQLite.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,19 @@ export function useSQLite({
210210
const mSQLite = new SQLiteConnection(sqlitePlugin);
211211
// add listeners
212212
let importListener: any = null;
213-
let exportListener: any = null;
214-
if(onProgressImport && sqlitePlugin) importListener =
215-
sqlitePlugin.addListener('sqliteImportProgressEvent',
216-
(e: any) => {
217-
onProgressImport(e.progress);
218-
});
219-
if(onProgressExport && sqlitePlugin) exportListener =
220-
sqlitePlugin.addListener('sqliteExportProgressEvent',
221-
(e: any) => {
222-
onProgressExport(e.progress);
223-
});
213+
let exportListener: any = null;
214+
if(platform != "electron") {
215+
if(onProgressImport && sqlitePlugin) importListener =
216+
sqlitePlugin.addListener('sqliteImportProgressEvent',
217+
(e: any) => {
218+
onProgressImport(e.progress);
219+
});
220+
if(onProgressExport && sqlitePlugin) exportListener =
221+
sqlitePlugin.addListener('sqliteExportProgressEvent',
222+
(e: any) => {
223+
onProgressExport(e.progress);
224+
});
225+
}
224226

225227
availableFeatures = {
226228
useSQLite: isFeatureAvailable('CapacitorSQLite', 'useSQLite')
@@ -230,8 +232,10 @@ export function useSQLite({
230232
* Remove Json Listeners
231233
*/
232234
const removeListeners = async (): Promise<void> => {
233-
importListener.remove();
234-
exportListener.remove();
235+
if(platform != "electron") {
236+
importListener.remove();
237+
exportListener.remove();
238+
}
235239
}
236240
/**
237241
* Echo value

0 commit comments

Comments
 (0)