2.3.1 • Published 7 years ago

js-abstract-synchronizer v2.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

js-abstract-synchronizer

MIT License Build Status

NPM status

This library works on:

  • backend like ODM or ORM
  • frontend making HTTP requests to save data on the server

install

npm install --save js-abstract-synchronizer

usage

import arangojs from 'arangojs';
import { SerializerFactory } from 'js-abstract-synchronizer';

const db = arangojs({ url: 'http//user:password@localhost:8529' });

class Person {
  constructor({ id, name, surname }) {
    this.id = id;
    this.name = name;
    this.surname = surname;
  }
  getName() {
    return this.name;
  }
  getSurname() {
    return this.surname;
  }
  setName(name) {
    this.name = name;
  }
  setSurname(surname) {
    this.surname = surname;
  }
}
const serializer = SerializerFactory.create({
  implementationName: 'ArangoSerializer',
  implementationParams: {
    db,
  },
  prototypes: {
    Person: Person.prototype,
  },
});

const alicia = serializer.create(new Person({ name: 'alicia', surname: 'aaa', id: 'foo' }));
const newAlicia = serializer.create({ id: 'foo' });

export default serializer.configure('database-name')
  .then(() => alicia.save())
  .then(() => console.log(alicia.getName()))
  .then(() => newAlicia.reload())
  .then(() => console.log(newAlicia.getName()))
});
2.3.1

7 years ago

2.2.1

7 years ago

2.1.8

7 years ago

2.1.7

7 years ago

2.1.6

7 years ago

2.1.5

7 years ago

2.1.4

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago