backbone-publication

1.0.12 • Public • Published

backbone-publication

Build Status

backbone-publication implements the boilerplate code that is required to make backbone and our publication based system (through publication-client) play nicely together. To use these classes, you simply need to instantiate them with the necessary reactive queries from a publication-client. This normally can be done in the bootstrapping process. For instance:

// During the bootstrapping process we normally initialize most
// collections/models - using `backbone-publication` collections/models is no
// different.
 
var featureCollection = new FeatureCollection(initialPayload.features, {
  // pubClient is initialized by using the `publication-client` constructor.
  reactiveQuery: pubClient.getCollection('features').find({ userId: getUser().id }),
  waitOn: pubClient.subscribe('features', ['branding'])
}));

Where FeatureCollection is defined as:

import { PublicationCollection } from 'backbone-publication';
 
// Note that we only need to extend the Publication[Collection,Model]s if we
// need to add custom behavioural overrides.
var FeatureCollection = PublicationCollection.extend({
  // Code removed for example purposes.
});
 
export default FeatureCollection;

Package Sidebar

Install

npm i backbone-publication

Weekly Downloads

73

Version

1.0.12

License

UNLICENSED

Unpacked Size

37.2 kB

Total Files

9

Last publish

Collaborators

  • alan-hadyk
  • leonardo-mixmax
  • dmytro.prysiazhnyi
  • laszlovaspal
  • akashbhalla
  • hishank
  • danyloderkach
  • sergey.polyarush
  • jordins
  • eugene.safronov.dewais
  • joneslloyd
  • kamilgruszka
  • tharindu-wj
  • aminao
  • enuma
  • adriandmitroca
  • mixmaxkristina
  • corridonimatias
  • mikusd
  • mixmax_it
  • andra.lazariuc
  • danaya
  • adborroto
  • aaavakian
  • dnechay
  • raphaelbs
  • guilhermemj
  • eduard.borges
  • mixmax-codeship
  • bradvogel
  • jessem3
  • jsalvata
  • gabriel-mixmax
  • ttacon