aliyun-oss-react-native

OSSCancellationToken.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2014, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. #import <Foundation/Foundation.h>
  11. #import "OSSCancellationTokenRegistration.h"
  12. NS_ASSUME_NONNULL_BEGIN
  13. /*!
  14. A block that will be called when a token is cancelled.
  15. */
  16. typedef void(^OSSCancellationBlock)(void);
  17. /*!
  18. The consumer view of a CancellationToken.
  19. Propagates notification that operations should be canceled.
  20. A OSSCancellationToken has methods to inspect whether the token has been cancelled.
  21. */
  22. @interface OSSCancellationToken : NSObject
  23. /*!
  24. Whether cancellation has been requested for this token source.
  25. */
  26. @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested;
  27. /*!
  28. Register a block to be notified when the token is cancelled.
  29. If the token is already cancelled the delegate will be notified immediately.
  30. */
  31. - (OSSCancellationTokenRegistration *)registerCancellationObserverWithBlock:(OSSCancellationBlock)block;
  32. @end
  33. NS_ASSUME_NONNULL_END