Commits

Joris Kluivers committed ffd74a1

Initial commit

Comments (0)

Files changed (4)

+# .gitignore in use by Joris Kluivers
+#
+# Latest version:
+# https://gist.github.com/gists/1923197
+
+*.DS_Store
+
+# Xcode
+*.pbxuser
+*.mode1v3
+*.move2v3
+*.perspectivev3
+*.xcuserstate
+project.xcworkspace/
+xcuserdata/
+
+build/
+
+# Generated
+*.o
+*.pyc 
+#import <Foundation/Foundation.h>
+
+@interface JKBackoffTimer : NSObject
+
+@property(nonatomic, assign) double slotTime;
+@property(nonatomic, assign) double truncateLimit;
+@property(nonatomic, copy) void(^retryBlock)();
+
++ (id) timerStartedWithSlot:(double)slotTime retryBlock:(void(^)())retryBlock;
+
+@end
+#import "JKBackoffTimer.h"
+
+@implementation JKBackoffTimer
+
+@synthesize slotTime, truncateLimit, retryBlock;
+
+- (id) init {
+    self = [super init];
+    
+    if (self) {
+        truncateLimit = DBL_MAX;
+    }
+    
+    return self;
+}
+
++ (id) timerStartedWithSlot:(double)slotTime retryBlock:(void(^)())retryBlock {
+    JKBackoffTimer *timer = [[JKBackoffTimer alloc] init];
+    timer.slotTime = slotTime;
+    timer.retryBlock = retryBlock;
+    [timer start];
+    
+    return timer;
+}
+
+@end
+## ARC usage
+
+This project is written using ARC. You will not find any memory management in these source files. If you need to use these files in a non-ARC project specify the `-fobjc-arc` compiler flag for the `JKBackoffTimer.m` file.