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

Compatibility with added/changed/removed in publish #9

Closed
steph643 opened this issue Jan 10, 2015 · 6 comments
Closed

Compatibility with added/changed/removed in publish #9

steph643 opened this issue Jan 10, 2015 · 6 comments

Comments

@steph643
Copy link

As you know, there are two methods to implement a publish function:

  1. By returning a cursor (or an array of cursors)
  2. By using this.added() / this.changed() / this.removed(), usually from cursor.observeChanges() callbacks

Let's consider these three use cases for method 2:
a. You want to add a field to a document before publication
b. You want to remove a field from a document before publication
c. You want to do both, for example to combine several secret fields into one public field

Does meteor-smart-publish allow for these three use cases?

@steph643
Copy link
Author

See the same question in publish-composite.

@yeputons
Copy link
Owner

@steph643 It's partially closed: you can use these three callbacks in top-level publish function, you may take a look at issue-9 branch.

I'll get back on this in a day or two.

@yeputons
Copy link
Owner

Just for me: do not forget about documenation and examples.

yeputons added a commit that referenced this issue Feb 1, 2015
… matter anymore; more tests for first-level callbacks
yeputons added a commit that referenced this issue Feb 1, 2015
Wrapper classes: getActiveItems() function was added
SingleCollectionCallbacksWrapper: stop() and onStop() methods were added
CollectionItem.updateChildren: now it uses getActiveItems() function and adds CallbacksWrapper for dependency function
smartPublish: now it calls wrapper.stop() instead of wrapper.observer.stop(), CallbacksWrapper is called too
@yeputons
Copy link
Owner

yeputons commented Feb 1, 2015

@steph643 Would you mind updating to the last version - v0.2.0 and testing it?

@yeputons
Copy link
Owner

@steph643 feel free to re-open this issue or create a new one in case of any problems

@steph643
Copy link
Author

@yeputons, sorry I had no time trying this.

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

No branches or pull requests

2 participants