FBLPromise+Delay.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. Copyright 2018 Google Inc. All rights reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at:
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #import "FBLPromise.h"
  14. NS_ASSUME_NONNULL_BEGIN
  15. @interface FBLPromise<Value>(DelayAdditions)
  16. /**
  17. Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or
  18. rejects with the same error immediately.
  19. @param interval Time to wait in seconds.
  20. @return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects
  21. with the same error immediately.
  22. */
  23. - (FBLPromise *)delay:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE("");
  24. /**
  25. Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or
  26. rejects with the same error immediately.
  27. @param queue A queue to dispatch on.
  28. @param interval Time to wait in seconds.
  29. @return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects
  30. with the same error immediately.
  31. */
  32. - (FBLPromise *)onQueue:(dispatch_queue_t)queue
  33. delay:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT;
  34. @end
  35. /**
  36. Convenience dot-syntax wrappers for `FBLPromise` `delay` operators.
  37. Usage: promise.delay(...)
  38. */
  39. @interface FBLPromise<Value>(DotSyntax_DelayAdditions)
  40. - (FBLPromise * (^)(NSTimeInterval))delay FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
  41. - (FBLPromise * (^)(dispatch_queue_t, NSTimeInterval))delayOn FBL_PROMISES_DOT_SYNTAX
  42. NS_SWIFT_UNAVAILABLE("");
  43. @end
  44. NS_ASSUME_NONNULL_END