peerlibrary:blaze-common-component

v0.5.0Published 5 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Common Component

An alternative base Blaze Component extended with common features.

Adding this package to your Meteor application adds CommonComponent and CommonMixin classes into the global scope.

Pull requests with new features are more than encouraged. Let us all combine our common practices and patterns together. We can always split it later into smaller packages.

Both client and server side.

Installation

meteor add peerlibrary:blaze-common-component

Usage

You can use CommonComponent as a base class for your components and CommonMixin for your mixins.

The idea is that instead of using Blaze global template helpers you can simply use methods shared between all your components by using a common base class for them. In this way interaction between helpers is much cleaner and can nicely tie into the rest of the object-oriented programming.

This package provides some common features community found useful in their components.

The suggested pattern is that in your application your first extend the CommonComponent with an app-level base class for all your components in the app, and then use that app-level base class in your app. Something like:

1class AppBaseComponent extends CommonComponent {
2  // All app-level methods.
3}
4
5class BlogPostComponent extends AppBaseComponent {
6  // Your component for blog posts.
7}
8
9BlogPostComponent.register('BlogPostComponent');

In this way it is easy to later on add new features app-wide. And remember, if some feature is very useful to you, it will probably be useful to others as well. Consider contributing it to this package.

Available features

See generated documentation for documentation of all features available.