kptaino / rebelle Goto Github PK
View Code? Open in Web Editor NEWObjective-C implementation of Promises/A+ (callback system) with a nice chainable syntax!
License: MIT License
Objective-C implementation of Promises/A+ (callback system) with a nice chainable syntax!
License: MIT License
Readme doesn't talk about what .next()
is for; however, in the sample project it is used. It would be nice if I didn't have to dig through the code to figure out what this method does.
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 nowRBResolver
which would do most of the work RBPromise
is currently doing. Goal is to implement all about the resolve algorithmRBPromise
would just become a Facade pattern object for RBExecuter
and RBResolver
. Plus it would handle recursivity/chainingStating 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
.
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.
Create a cancel method so promises can be canceled.
Sure when canceling a promise that should cancel all that are chained to it.
Unhandled exceptions are (for now) silently ignored.
They should be re-thrown on main thread if there is no promise to handle it
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?
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:
Just wanted to share some ideas. Love the framework you've started (especially your use of blocks!)!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.