Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial functional commit #1

Merged
merged 9 commits into from
Feb 7, 2017
Merged

Conversation

ttacon
Copy link
Contributor

@ttacon ttacon commented Feb 6, 2017

No description provided.

@@ -1,2 +1,44 @@
# backbone-meteor
Backbone.Model and Backbone.Collection that supports observing a publication-client based reactive query
# backbone-publication
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this public btw. We initially promised to a year and a half ago haha https://mixmax.com/blog/meteor-and-backbone

README.md Outdated
// During the bootstrapping process we normally set most collections/models -
// using `backbone-publication` collections/models is no different.

setUserFeatures(new FeatureCollection(initialPayload.features, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this public I'd remove the setUserFeatures part. You can keep "bootstrapping" though, just s/we normally set/we normally initialize.

Where FeatureCollection is defined as:

```js
import { PublicationCollection } from 'backbone-publication';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice design, I had been picturing continuing to get the classes like Backbone.PublicationCollection but I like this better.

README.md Outdated
```js
import { PublicationCollection } from 'backbone-publication';

class FeatureCollection extends PublicationCollection {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately Backbone doesn't play well with ES6 classes: jashkenas/backbone#3560

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleared live, we could make them play nicely enough, but we've decided not to for the moment since it doesn't give us any major gain.

README.md Outdated

There really shouldn't be any differences when migrating from
Backbone.Meteor[Model,Collection] - all the differences are handled under the
hood.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave this out, it'll become a moot point soon enough :)


if (!options.silent) {
// Trigger events for any nested objects.
_.each(newAttributes, function(value, key, attributes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use an arrow function

if (options.unset) {
Backbone.Model.prototype.unset.call(this, fullAttributes, options);
} else {
Backbone.Model.prototype.set.call(this, fullAttributes, options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PublicationModel.__super__ etc.

/**
* Override unset implementation to use the overridden version of set above.
*/
unset(key, value, options) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you're just copying this over but I think this will use the overridden version anyway…? http://backbonejs.org/docs/backbone.html#section-75

/**
* Sets the reactive query to the given reactive query.
* NOTE: if you use this functionality, you'll need to also call
* `startObservingChanges` in order to re-initialize the model's listeners.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds fine to me that we would make the user call startObservingChanges again. This should call stopObservingChanges to be safe though, no?

src/index.js Outdated
@@ -0,0 +1,8 @@
import PublicationCollection from './PublicationCollection';
import PublicationModel from './PublicationModel';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want one liners you can do export { default } from './PublicationModel' or export { default as PublicationModel } from './PublicationModel' btw. And for even shorter, export PublicationModel from './PublicationModel' (the ideal IMO), it looks like you can use this plugin. Background.

@ttacon
Copy link
Contributor Author

ttacon commented Feb 7, 2017

@wearhere PTAL

Copy link
Contributor

@wearhere wearhere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one tiny doc fix and then lgtm

package.json Outdated
@@ -1,5 +1,5 @@
{
"name": "@mixmaxhq/backbone-publication",
"name": "backbone-publication",
"version": "0.0.0",
"description": "Publication backed Backbone.Meteor and Backbone.Collection classes",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outdated

@ttacon ttacon merged commit e49a156 into master Feb 7, 2017
@ttacon ttacon deleted the trey/initial-functional-commit branch February 7, 2017 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants