Function
| Static Public Summary | ||
| public |
Sets up the channel for subcriptions. |
|
| public |
highlight(el: *, words: *, options: *): * |
|
| public |
Decorator for publishing on an event bus (postal). |
|
| public |
Decorator for listening on an event bus (postal). |
|
Static Public
public channel(channelName: String): * source
import channel from 'rizzo-next/src/core/decorators/channel.js'Sets up the channel for subcriptions. Keep in mind that after you use it, all other subscriptions underneath will use the same channel
Params:
| Name | Type | Attribute | Description |
| channelName | String | Channel name for the class |
Return:
| * |
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
}
}
See:
public highlight(el: *, words: *, options: *): * source
import highlight from 'rizzo-next/src/core/utils/highlight.js'Params:
| Name | Type | Attribute | Description |
| el | * | ||
| words | * | ||
| options | * |
Return:
| * |
public publish(topic: String, channel: String): * source
import publish from 'rizzo-next/src/core/decorators/publish.js'Decorator for publishing on an event bus (postal).
Whatever the decorated function returns gets published as the data.
Will search the class for a channel, or use / by default.
Return:
| * |
Example:
import "publish" from "path/to/core/decorators/publish"
class FooComponent () {
@publish("foo.some.message")
someMethod() {
return {
my: "data"
};
}
@publish("foo.some.other")
anotherMethod() {
// ...
}
}
public subscribe(topic: String, options: Object): * source
import subscribe from 'rizzo-next/src/core/decorators/subscribe.js'Decorator for listening on an event bus (postal).
Will search the class for a channel, or use / by default.
NOTE: You have to call this.subscribe() in the constructor in order to have postal actually attatch the listeners correctly.
Return:
| * |
Example:
import publish from "path/to/core/decorators/publish"
class FooComponent () {
constructor() {
// This is required
this.subscribe();
}
@subscribe("foo.some.message")
someMethod(data, evnelope, subscription) {
}
@subscribe("foo.some.other")
anotherMethod(data, evnelope, subscription) {
// ...
}
}
import publish from "path/to/core/decorators/publish"
class FooComponent () {
constructor() {
// This is required
this.subscribe();
}
@subscribe("foo.some.message", "custom")
someMethod(data, envelope, subscription) {
// ...
}
}
import publish from "path/to/core/decorators/publish";
import channel from "path/to/core/decorators/channel"
class FooComponent () {
constructor() {
// This is required
this.subscribe();
}
@subscribe("foo.some.message")
@channel("custom")
someMethod(data, envelope, subscription) {
// ...
}
}