Skip to content

ksylvest/encore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encore

Version License Platform

Usage

Encore is for queueing callbacks. It ensures that a single executor runs a block while other callbacks block.

+ (void)process:(void(^)(NSError *error))callback
{
    static KSEncore *encore;
    static dispatch_once_t token;
    dispatch_once(&token, ^{ encore = [KSEncore new]; });
  
    [encore queue:callback block:^{
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            // ...
            dispatch_async(dispatch_get_main_queue(), ^{
                [encore flush:^(void (^callback)(NSError *error)) {
                    callback(error);
                }];
            });
        });
    }];
}

Installation

Encore is available through CocoaPods. To install it add the following line to your Podfile:

pod "KSEncore"

Author

Kevin Sylvestre, kevin@ksylvest.com

License

Encore is available under the MIT license. See the LICENSE file for more info.

About

Encore eliminates duplicate calls by queueing callbacks.

Resources

License

Stars

Watchers

Forks

Packages

No packages published