https://github.com/mixmaxhq/backbone-publication
Backbone.Model and Backbone.Collection that supports observing a publication-client based reactive query
https://github.com/mixmaxhq/backbone-publication
corgi-tag
Last synced: 19 days ago
JSON representation
Backbone.Model and Backbone.Collection that supports observing a publication-client based reactive query
- Host: GitHub
- URL: https://github.com/mixmaxhq/backbone-publication
- Owner: mixmaxhq
- Created: 2017-02-06T14:06:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-20T18:50:47.000Z (over 1 year ago)
- Last Synced: 2025-04-24T10:03:48.225Z (28 days ago)
- Topics: corgi-tag
- Language: JavaScript
- Homepage: https://www.mixmax.com/careers
- Size: 434 KB
- Stars: 2
- Watchers: 27
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# backbone-publication
[](https://travis-ci.org/mixmaxhq/backbone-publication)`backbone-publication` implements the boilerplate code that is required to make
`backbone` and our publication based system (through
[`publication-client`](https://github.com/mixmaxhq/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:```js
// 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:
```js
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;
```