Giter VIP home page Giter VIP logo

Comments (6)

davidwdan avatar davidwdan commented on July 17, 2024

@taion I'm using $q.when to wrap the autobahn promise with a $q promise, so that the returned value is a $q promise instead of an autobahn one, which makes it resolve within the digest cycle.

I'm not sure if $q.defer would behave the same way.

Is there a particular issue that this is causing?

from angular-wamp.

taion avatar taion commented on July 17, 2024

Nope, this is just idle speculation - it just looks like the use_deferred connection option would let you skip the wrapping step and just have AutobahnJS directly use the $q.defer constructor instead of having to wrap it. Might be a minor optimization.

from angular-wamp.

davidwdan avatar davidwdan commented on July 17, 2024

@taion Sorry, I didn't understand your original question. I've made this change.

Can you test it out and let me know if it's working as expected?

from angular-wamp.

taion avatar taion commented on July 17, 2024

This change works for me. It's not a big thing, but I think it's a little bit cleaner. You may want to undocument the deferral-related options, since they're no longer relevant, though:

* - `use_deferred`: `{callable=}` - if provided, use this deferred constructor, e.g. jQuery.Deferred or Q.defer

from angular-wamp.

davidwdan avatar davidwdan commented on July 17, 2024

All options can be overwritten in the config. I'm not sure if there really is a use case for changing the deferred or not, but I'll leave it there for consistencies sake and just add a note.

from angular-wamp.

taion avatar taion commented on July 17, 2024

The only case I can really think of where you'd want something beyond the $q.defer might be for angular-poller, because it's a bit annoying that those promises can't ever get resolved, so they can't go into a route's resolve block. That's quite a stretch, though, and presumably you wouldn't be using angular-poller if you're using something WAMP-based anyway.

Thanks!

from angular-wamp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.