question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

subscriptions: object or array?

See original GitHub issue

I’m noticing in the choo docs subscriptions is referred to as an array:

  subscriptions: [
    (send, done) => {
      setInterval(() => {
        send('app:print', { payload: 'dog?', myOtherValue: 1000 }, (err) => {
          if (err) return done(err)
        })
      }, 1000)
    }
  ]

https://github.com/yoshuawuyts/choo#subscriptions

But in the barracks docs it’s a plain object with named keys:

  subscriptions: {
    emitWoofs: (send, done) => {
      // emit a woof every second
      setInterval(() =>  send('printWoofs', { woof: 'meow?' }, done), 1000)
    }
  }

https://github.com/yoshuawuyts/barracks#subscriptions

I’ve seen it referred to both ways – so which should it be?

Bonus question: if subscriptions is an object, do key names have any bearing on other aspects (reducers, effects, actions)?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
yoshuawuytscommented, Aug 9, 2016

lol, javascript

0reactions
yoshuawuytscommented, Jan 15, 2017

It should be an object (:

On Sun, Jan 15, 2017 at 12:09 AM Haroen Viaene notifications@github.com wrote:

needs to be fixed in template-basic 😄

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/yoshuawuyts/choo/issues/217#issuecomment-272660216, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWler8wGyvT1iljwWu7PBCK2imR7P4Kks5rSVWrgaJpZM4Jfs7X .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular subscribe push object to array - Stack Overflow
subscribe(response => this.users = response.data); // This will directly store your response data in an array of objects.
Read more >
Array - JavaScript - MDN Web Docs
The Array object, as with arrays in other programming languages, enables storing a collection of multiple items under a single variable name ...
Read more >
The subscription item object - Stripe API reference
Describes how to compute the price per period. Either per_unit or tiered . per_unit indicates that the fixed amount (specified in unit_amount or ......
Read more >
Array of Objects - Braze
This reference article covers using an array of objects as a data type for custom attributes, including limitations and usage examples.
Read more >
Subscription - RxJS
A Subscription is an object that represents a disposable resource, usually the execution of an Observable. A Subscription has one important method, unsubscribe ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found