Skip to content

Commit

Permalink
Remove named returns to increase code readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalita committed Mar 16, 2022
1 parent 6af33b6 commit 4fb53b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ably/realtime_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ func (*subscriptionMessage) isEmitterData() {}
//
// See package-level documentation on Event Emitter for details about
// messages dispatch.
func (c *RealtimeChannel) Subscribe(ctx context.Context, name string, handle func(*Message)) (unsubscribe func(), err error) {
unsubscribe = c.messageEmitter.On(subscriptionName(name), func(message emitterData) {
func (c *RealtimeChannel) Subscribe(ctx context.Context, name string, handle func(*Message)) (func(), error) {
unsubscribe := c.messageEmitter.On(subscriptionName(name), func(message emitterData) {
handle((*Message)(message.(*subscriptionMessage)))
})
res, err := c.attach()
Expand All @@ -454,8 +454,8 @@ func (c *RealtimeChannel) Subscribe(ctx context.Context, name string, handle fun
//
// See package-level documentation on Event Emitter for details about
// messages dispatch.
func (c *RealtimeChannel) SubscribeAll(ctx context.Context, handle func(*Message)) (unsubscribe func(), err error) {
unsubscribe = c.messageEmitter.OnAll(func(message emitterData) {
func (c *RealtimeChannel) SubscribeAll(ctx context.Context, handle func(*Message)) (func(), error) {
unsubscribe := c.messageEmitter.OnAll(func(message emitterData) {
handle((*Message)(message.(*subscriptionMessage)))
})
res, err := c.attach()
Expand Down
8 changes: 4 additions & 4 deletions ably/realtime_presence.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ func (*subscriptionPresenceMessage) isEmitterData() {}
//
// See package-level documentation on Event Emitter for details about
// messages dispatch.
func (pres *RealtimePresence) Subscribe(ctx context.Context, action PresenceAction, handle func(*PresenceMessage)) (unsubscribe func(), err error) {
unsubscribe = pres.messageEmitter.On(action, func(message emitterData) {
func (pres *RealtimePresence) Subscribe(ctx context.Context, action PresenceAction, handle func(*PresenceMessage)) (func(), error) {
unsubscribe := pres.messageEmitter.On(action, func(message emitterData) {
handle((*PresenceMessage)(message.(*subscriptionPresenceMessage)))
})
res, err := pres.channel.attach()
Expand All @@ -295,8 +295,8 @@ func (pres *RealtimePresence) Subscribe(ctx context.Context, action PresenceActi
//
// See package-level documentation on Event Emitter for details about
// messages dispatch.
func (pres *RealtimePresence) SubscribeAll(ctx context.Context, handle func(*PresenceMessage)) (unsubscribe func(), err error) {
unsubscribe = pres.messageEmitter.OnAll(func(message emitterData) {
func (pres *RealtimePresence) SubscribeAll(ctx context.Context, handle func(*PresenceMessage)) (func(), error) {
unsubscribe := pres.messageEmitter.OnAll(func(message emitterData) {
handle((*PresenceMessage)(message.(*subscriptionPresenceMessage)))
})
res, err := pres.channel.attach()
Expand Down

0 comments on commit 4fb53b7

Please sign in to comment.