Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cnkcq/globaltimer
A simple to use library that gets around a load of problems that arise when you start trying to do much inside 'loop'.
https://github.com/cnkcq/globaltimer
loop objective-c timer-clock
Last synced: about 6 hours ago
JSON representation
A simple to use library that gets around a load of problems that arise when you start trying to do much inside 'loop'.
- Host: GitHub
- URL: https://github.com/cnkcq/globaltimer
- Owner: CNKCQ
- License: mit
- Created: 2018-01-26T10:17:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-17T08:02:50.000Z (over 4 years ago)
- Last Synced: 2024-10-02T05:04:50.334Z (about 6 hours ago)
- Topics: loop, objective-c, timer-clock
- Language: Objective-C
- Homepage:
- Size: 1.05 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GlobalTimer
[![CI Status](http://img.shields.io/travis/[email protected]/GlobalTimer.svg?style=flat)](https://travis-ci.org/[email protected]/GlobalTimer)
[![Version](https://img.shields.io/cocoapods/v/GlobalTimer.svg?style=flat)](http://cocoapods.org/pods/GlobalTimer)
[![License](https://img.shields.io/cocoapods/l/GlobalTimer.svg?style=flat)](http://cocoapods.org/pods/GlobalTimer)
[![Platform](https://img.shields.io/cocoapods/p/GlobalTimer.svg?style=flat)](http://cocoapods.org/pods/GlobalTimer)![images](https://user-images.githubusercontent.com/8440220/35437284-a5b4d8e6-02cc-11e8-92c3-d349a60a0e5e.jpeg)
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
* Xcode
* Objective-C## Features
- [x] start a loop with an event.
- [x] pause a specific loop.
- [x] active a specific loop.
- [x] remove a specific loop.
- [x] update a loop with a new interval## Installation
GlobalTimer is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'GlobalTimer'
```## Api
```Objective-C
+ (instancetype _Nonnull )shared;- (void)scheduledWith: (NSString * _Nonnull )identifirer timeInterval: (NSTimeInterval)interval repeat:(BOOL)repeat block:(GTBlock _Nonnull )block userinfo:(NSDictionary * _Nullable)userinfo;
- (void)updateEventWith: (NSString * _Nonnull )identifirer timeInterval: (NSTimeInterval)interval repeat:(BOOL)repeat block:(GTBlock _Nonnull )block userinfo:(NSDictionary * _Nullable)userinfo;
- (void)pauseEventWith: (NSString *_Nonnull)identifirer;
- (void)removeEventWith: (NSString *_Nonnull)identifirer;
- (void)activeEventWith:(NSString *_Nonnull)identifirer;
- (NSArray *_Nonnull)eventList;
```## :book: Usage
```Objective-C
[[GTimer shared] scheduledWith:@"first" timeInterval:2 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"πΊπΈ%@", userinfo[@"test"]);
} userinfo:@{@"test": @"ok"}];
[[GTimer shared] scheduledWith:@"second" timeInterval:5 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"πΊ%@", userinfo[@"cnkcq"]);
} userinfo:@{@"cnkcq": @"king"}];
[[GTimer shared] scheduledWith:@"dog" timeInterval:5 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"πΆ%@", userinfo[@"dog"]);
} userinfo:@{@"dog": @"ζΊθ΄’"}];
[[GTimer shared] scheduledWith:@"fourth" timeInterval:10 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"π±%@", userinfo[@"cat"]);
} userinfo:@{@"cat": @"εͺεͺ"}];```
```Objective-C
[[GTimer shared] pauseEventWith:@"dog"];
NSLog(@"%@", [[GTimer shared] eventList]);
[[GTimer shared] activeEventWith:@"dog"];
[[GTimer shared] removeEventWith:@"fourth"];
```
## Reprensent
![ti](https://user-images.githubusercontent.com/8440220/35437059-c17cdb56-02cb-11e8-9a3c-b3a5cec90be8.jpg)
## Author[email protected], [email protected]
## License
GlobalTimer is available under the MIT license. See the LICENSE file for more info.