trying migration from cordova to capacitor

This commit is contained in:
tiago.kayaya
2021-11-04 10:41:43 +01:00
parent 0cb4097c88
commit 98cb655735
12 changed files with 268 additions and 2199 deletions
+15 -16
View File
@@ -1,5 +1,4 @@
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
///<reference path="../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" />
import { Injectable } from "@angular/core";
@Injectable({
@@ -8,7 +7,7 @@ import { Injectable } from "@angular/core";
export class JsonStore {
createCollection(name, data) {
/* createCollection(name, data) {
var collectionName = name;
var addOptions = {
@@ -32,7 +31,7 @@ export class JsonStore {
console.log(err)
});
}
} */
getCollection(collectionName) {
@@ -50,11 +49,11 @@ export class JsonStore {
JSONStoreCollections[collectionName] = {};
JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' };
WL.JSONStore.init(JSONStoreCollections)
/* WL.JSONStore.init(JSONStoreCollections)
.then(function () {
WL.Logger.debug('Find all colletion data');
console.log('Find all colletion data');
}).fail(function (err) {
WL.Logger.error(err);
@@ -66,8 +65,8 @@ export class JsonStore {
return JSON.parse(value);
});
return data
return data */
//return notificationData
}
@@ -90,7 +89,7 @@ export class JsonStore {
JSONStoreCollections[collectionName] = {};
JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' };
WL.JSONStore.init(JSONStoreCollections)
/* WL.JSONStore.init(JSONStoreCollections)
.then(function () {
WL.Logger.debug('Find colletion data by id');
console.log('Find colletion data by id');
@@ -101,30 +100,30 @@ export class JsonStore {
}).fail(function (err) {
WL.Logger.error(err);
console.log(err)
});
}); */
}
replaceDocument(collectionName: string, document: any) {
/* var document = { Example of how identify the document to replace
/* var document = { Example of how identify the document to replace
_id: 1, json: {name: 'chevy', age: 23}
}; */
var options = {};
WL.JSONStore.get(collectionName).replace(document, options).then(function (numberOfDocsReplaced) {
/* WL.JSONStore.get(collectionName).replace(document, options).then(function (numberOfDocsReplaced) {
console.log("JsonStore replace document sucess: ", numberOfDocsReplaced)
}).fail(function (error) {
console.log("JsonStore replace document error: ", error)
});
}); */
}
removeDocument(collectionName: any,query: any,) {
/* var query = { _id: 1 }; Exemple of query*/
var options = { exact: true };
WL.JSONStore.get(collectionName).remove(query, options).then(function (numberOfDocsRemoved) {
/* WL.JSONStore.get(collectionName).remove(query, options).then(function (numberOfDocsRemoved) {
console.log("JsonStore remove document sucess: ", numberOfDocsRemoved)
}).fail(function (error) {
console.log("JsonStore remove document erro: ", error)
});
}); */
}
}
}