How to use the kinvey-nativescript-sdk.Kinvey.DataStore function in kinvey-nativescript-sdk

To help you get started, we’ve selected a few kinvey-nativescript-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NativeScript / nativescript-app-templates / packages / template-master-detail-kinvey-ng / cars / shared / car.service.ts View on Github external
"luggage",
    "name",
    "price",
    "seats",
    "imageUrl"
];

@Injectable()
export class CarService {
    private static cloneUpdateModel(car: Car): object {
        // tslint:disable-next-line:ban-comma-operator
        return editableProperties.reduce((a, e) => (a[e] = car[e], a), { _id: car.id });
    }

    private allCars: Array = [];
    private carsStore = Kinvey.DataStore.collection("cars");

    getCarById(id: string): Car {
        if (!id) {
            return;
        }

        return this.allCars.filter((car) => {
            return car.id === id;
        })[0];
    }

    load(): Observable {
        return new Observable((observer: any) => {
            this.login().then(() => {
                return this.carsStore.sync();
            }).then(() => {