Skip to content

API / geotoolkit / util / Cancel / Cancel

Class: Cancel

util.Cancel.Cancel

A Cancel is an object that can be used to request cancellation of an operation inside of Promise.

Table of contents

Constructors
  • [new Cancel()](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.util.cancel.cancel.md#new cancel())
Methods

Contents

Constructors

new Cancel()

• new Cancel()

Methods

cancel

▸ cancel(message?): void

Cancel promise

Parameters

Name Type Description
Optional messagestringmessage

Returns

void


getMessage

▸ getMessage(): string

Return message

Returns

string


isCanceled

▸ isCanceled(): boolean

Return true if it was canceled

Returns

boolean


setErrorHandler

▸ setErrorHandler(callback): void

Sets an error handler

Parameters

Name Type Description
callback(cancel: Cancel) => voidto be called if cancellation happens

Returns

void


isCanceled

▸ Static isCanceled(error): boolean

Returns true if input parameter is cancel

Parameters

Name Type Description
erroranyerror to check if it is cancellation error

Returns

boolean