Giter Site home page Giter Site logo

rebelle's People

Contributors

kemenaran avatar kptaino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kemenaran

rebelle's Issues

Add OSX support

Hey there! This library looks great, but I was wondering, is it really only compatible with iOS or is that just what the Podfile defaulted to?

Add a cancel method

Create a cancel method so promises can be canceled.
Sure when canceling a promise that should cancel all that are chained to it.

Confusion in the readme about how to resolve with an error

The readme seems to suggest that you can only resolve with an error by returning an NSException object. However, in the sample code, in the placesForQuery method of the PMNavitiaClient class, it seems to be resolving with an error by passing an NSError object.

Promise not correctly updated when resolve: with another Promise

Stating from promises-spec:

quote 1

If onFulfilled[/onRejected] is a function:

  • it must be called after promise is fulfilled[/rejected], with promise's value[/reason] as its first argument

quote 2

If x is a promise, adopt its state:

  • If/when x is fulfilled, fulfill promise with the same value.
  • If/when x is rejected, reject promise with the same reason

Rebelle is actually resolving the promise chain with the correct value/reason from x (quote 2) but promise still keep x as its result.
As stated in quote 1 x result should indeed be "copied" as the promise result instead of x.

Separate resolving algorithm

To support future features (including new callback syntax) current code should be divided into 3 classes instead of 2:

  • RBExecuter to execute callbacks just as now
  • RBResolver which would do most of the work RBPromise is currently doing. Goal is to implement all about the resolve algorithm
  • RBPromise would just become a Facade pattern object for RBExecuter and RBResolver. Plus it would handle recursivity/chaining

helper functions, maybe based on Q.js?

Hi again!

I'm not sure if you've used this before, but there's a really great Node.js library based on promises and I was thinking it would be cool to see some of them in Cocoa.

https://github.com/kriskowal/q

I think the big ones that would stand out are:

  • Q.all - returns a promise that doesn't resolve until all promises in the array have resolved
  • Q.spread - alternate to "then" for when you have an array as a resolved value (i.e., multiple values)
  • Callback wrappers. This might be tough to implement as there's not a standard convention in Cocoa for callbacks, but would still be handy. For an example, I've been working with the Spotify framework (libspotify), which is all based on callbacks. It would be so much easier to work with if we had something like Q.nfcall() in Cocoa!

Just wanted to share some ideas. Love the framework you've started (especially your use of blocks!)!

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.