GithubHelp home page GithubHelp logo

vadymmarkov / when Goto Github PK

View Code? Open in Web Editor NEW
264.0 264.0 35.0 428 KB

:alarm_clock: A lightweight implementation of Promises in Swift

Home Page: https://github.com/vadymmarkov

License: Other

Swift 97.55% Ruby 2.00% Shell 0.45%
promise swift

when's People

Contributors

codeofrobin avatar cruisediary avatar daneov avatar johnsundell avatar mallexxx avatar onmyway133 avatar sirioz avatar vadymmarkov avatar yuryks avatar zenangst avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

when's Issues

Default DispatchQueue

Maybe queue should be optional? Regularly I want execute promise callback in same queue where promise was created. I want set queue explicitly for async operations. Now i am change default queue from .main to 'instant', but i want rework dispatch in my fork in future. If you agreed with me i can make PR.

Sorry for bad english.

Calling 'when' with more than 3 promises

I stumbled upon a case where I need to pass 4 promises to the when function, and they all return different types. Therefore I can't use the function that receives an Array<T>.

Is there a specific reason to limit the function to 3 promises? Or is it just because it would need to repeat pretty much similar pieces of code for each number of inputs?

WhenRx as an optional dependency?

Is there any way to include When as a dependency via Carthage and have it not pull down RxSwift et al? I won't be using that part of the library and it basically introduces a huge overhead to my Cartfile checkouts and builds otherwise.

WatchOS

Is there any reason for not porting this to WatchOS that you know of?
Or could I try opening a PR to get this added? :)

Done handlers not called if promise already resolved

This code will print 5:

let promise = Promise<Int>(queue: DispatchQueue.global())
promise.done { result in
    print(result)
}
promise.resolve(5)

But this is not:

let promise = Promise<Int>(queue: DispatchQueue.global())
promise.resolve(5)
promise.done { result in
    print(result)
}

This behavior is by design?

When.BarrierQueue

Hello! I found what barrier queue is concurrent:

Functions.swift:

let barrierQueue = DispatchQueue(label: "When.BarrierQueue", attributes: DispatchQueue.Attributes.concurrent)

But it must be serial to behave as real barrier. Misprint?

Duplicate bundle identifier for When and RxWhen

When and RxWhen both have the same bundle identifier which prevents using both at the same time. Also, RxWhen depends on When, which means both are meant to be used at the same time.

error

Proposed Solution:
Rename the Bundle identifiers for RxWhen to RxWhen-iOS, RxWhen-Mac, etc.

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.