UNPKG

rizzo-next

Version:

The next generation of Lonely Planet's style guide and pattern library.

31 lines (30 loc) 786 B
/** * Sets up the channel for subcriptions. * Keep in mind that after you use it, all other subscriptions underneath will use the same channel * @see subscribe * @param {String} channelName Channel name for the class * @example * import "publish" from "path/to/core/decorators/publish" * * class FooComponent () { * @subscribe("foo.some.other") * @channel("foobar") * anotherMethod() { * // ... * } * @subscribe("foo.yet.another") * anotherMethod() { * // Still on the "foobar channel" * } * @subscribe("foo.yet.another") * @channel("another") * anotherMethod() { * // Now we're on another channel * } * } */ export default function channel(channelName) { return function(target) { target.channel = channelName; }; }