Skip to content

一个可以轻松取消延时任务的工具类

License

Notifications You must be signed in to change notification settings

xhjcs/YXDelayTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YXDelayTask

License MIT  CocoaPods  Support 

Support for the cancellation of the delayed task framework.

Features

  • Delay: Deferred execution code.
  • Queue: Support for specifying thread queue.
  • Cancel: Support cancellation delay task .

Usage

    YXDelayTask *delayTask = [YXDelayTask delay:1.0 task:^{
        NSLog(@"heiheihei");
    }];

    [delayTask cancel];

    YXDelayTask *delayTask1 = [YXDelayTask delay:3.0 queue:self.queue task:^{
        NSLog(@"hahaha");
    }];

    // 延迟2.5秒取消
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), self.queue, ^{
        [delayTask1 cancel];
    });

Installation

CocoaPods

  1. Add pod 'YXDelayTask' to your Podfile.
  2. Run pod install or pod update.
  3. import <YXDelayTask/YXDelayTask.h>.

About

一个可以轻松取消延时任务的工具类

Resources

License

Stars

Watchers

Forks

Packages