Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Henry Snopek
    @hhsnopek
    and it worked, so it was referencing separate backbone.radio dependencies
    that should be fixed once npm 3 hits though
    Ian Stewart
    @ianmstew
    There must’ve been a separate Radio dep under the module’s node_modules
    Henry Snopek
    @hhsnopek
    yeah
    Ian Stewart
    @ianmstew
    I hope they fix it, that’s a nasty issue :/
    Henry Snopek
    @hhsnopek
    in npm 3 all deps are flat, so all projects will access the same deps instead of their nested deps
    Ian Stewart
    @ianmstew
    Whoa, that is radical
    Henry Snopek
    @hhsnopek
    yeah, it's gonna be a sick update
    Ian Stewart
    @ianmstew
    I’m wondering what other problems that could cause :- o
    Henry Snopek
    @hhsnopek
    thank you again :D
    haha it'll be interesting but you can install 2 versions of a dep
    Ian Stewart
    @ianmstew
    Sure thing! Btw in my underscore situation I solved it by setting the underscore version string in all package.json’s to the exact same value.
    For some reason when npm install saw the exact same version strings it did not install the duplicated nested dep
    Henry Snopek
    @hhsnopek
    hmm weird, cause my version string was the same in both projects
    Ian Stewart
    @ianmstew
    Hmm
    Yeah, maybe that’s just a headache then...
    Cool, well good know about npm 3 :)
    Henry Snopek
    @hhsnopek
    haha yeah, I actually was using npm 3 beta until I had to move back to npm 2 for other projects
    oh well, thanks :D
    Ian Stewart
    @ianmstew
    sure!
    Christopher Shelley
    @basiclaser
    hey y’all is anyone still present?
    Jason Laster
    @jasonLaster
    Hey
    Your best bet is to stop by the marionette room
    Ilmir
    @rimlin
    This message was deleted
    Jake Aitchison
    @milkshakeuk
    hello guys could I just check is channel.trigger just an alias for channel.request or is their an legitimate difference?
    Paul Falgout
    @paulfalgout
    @milkshakeuk trigger is the backbone events API where one thing triggers an event and many thing can listen to it. request however can have only one responder, but many requesters. A triggered event also won’t return data, but a request can.
    NewstHet
    @NewstHet
    hey I've got here a question related to backbone.radio: http://stackoverflow.com/questions/37111765/marionette-object-initialize-reference-undefined-when-using-radio would like to know what you thing causing the undefined problem. thanks
    NewstHet
    @NewstHet
    WELL I found the problem... it's a good thing to look at the API some times ...I didn't pass the 'context' :=> this reply: function(name, callback, context). problem solved
    Adam Venturella
    @aventurella
    Curious about a design choice in Radio.Requests. Since it's inheriting from Backbone.Events (a Channel) and Requests are REALLY meant to be used in a Channel, why not uniquely prefix a channel on init aka: let channelId = uniqid()
    and just use that prefix on events
    and use the built in events mechanisms
    reply is sort of-ish like listenTo
    anyway just curious
    I mean Request literally leaks the idea of a channel in it's request() implementation: https://github.com/marionettejs/backbone.radio/blob/master/src/backbone.radio.js#L183
    Daniel Hååg
    @Frinsh
    I want to check if an event has already been triggered, can I do this without accessing _events in the channel?
    I am using https://github.com/typekit/webfontloader and I want to check if a font has loaded or not, if it has, then my channel will fire the event. This can happen before or after a view has been rendered
    Paul Falgout
    @paulfalgout
    @Frinsh seems to me like you just want to check the state at a particular time. I believe webfontloader stores it on the <html> tag
    Daniel Hååg
    @Frinsh

    Sure, I suppose that is a solution although quite an ugly one in my opinion:

    if ($(document).hasClass('wf-cubano-n4-active')) {
      this.slabtextTitles()
    } else {
      fontChannel.on('render:Cubano', this.slabtextTitles)
    }

    Since I am already using backbone.radio in my application, I think it would make sense if I can retroactively check if there is an event that already has been fired

    Instead of using the private _event array
    But I suppose it's an edge case :)
    Allan Bazinet
    @bazineta
    Well, the WFL will emit a ‘fontactive’ event; when you load the font, you could just listen for that and issue a render event when it happens, and for tracking purposes also maintain a list of the ones that have loaded that you could ask the channel the load status of.
    Paul Falgout
    @paulfalgout
    yep. I think that's the best approach.. if you don't like how they maintain state, maintain it yourself. But I don't really understand retroactive events
    Allan Bazinet
    @bazineta
    i.e., first ask the channel if the font has loaded, if not, wait for the load event to be issued by the channel. However, all that is sort of what a $.Deferred can do for you without involving a channel.
    That is, maintain some state object that you modify based on ‘fontactive’ events. Ask that object for a font availability, and it either returns a deferred that’s resolved immediately as the font is present, or in the future, as it’s waiting.
    Allan Bazinet
    @bazineta
    Or really any of the Promise solutions; $.Deferred is just typically already there and usable. Bottom line, seems to me that you’re dealing with needing to render immediately because the font has loaded, or in the future because it hasn’t, and that’s sort of a Promise thing, rather than a communications channel thing, IMO.
    Paul Falgout
    @paulfalgout
    :point_up:
    @Frinsh
    Daniel Hååg
    @Frinsh
    Sorry for the very late reply

    Promise:

    export default function (font) {
      return new Promise((resolve) => {
        if ($('html').hasClass(`wf-${font}-n4-active`.toLowerCase())) {
          resolve()
        }
    
        fontChannel.on(font, () => {
          resolve()
        })
      })
    }

    View:

      onAttach() {
        onFontReady('Cubano').then(() => {
          this.ui.title.slabText()
        })
      }

    Config for the webfontloader:

    import WebFonts from 'webfontloader'
    
    WebFonts.load({
      custom: {
        families: ['MuseoSans', 'Cubano'],
      },
      fontactive(family) {
        fontChannel.trigger(family)
      },
    })
    Simple and a bit dirty but it works, thanks for the help @paulfalgout and @bazineta :)