Skip to main content

@journeyapps/reactor-lib-utils

Enumerations

EnumerationDescription
MimeTypes-
ReactorDateFormats-

Classes

ClassDescription
EventEmitterNot to be confused with node's EventEmitter. This is a typed emitter
MutexMutex maintains a queue of Promise-returning functions that are executed sequentially (whereas normally they would execute their async code concurrently).
ReactorPath-

Interfaces

ComputeDateTimePartsOptions

Properties

PropertyType
_debugLocale?boolean
dateReactorDateType
formatReactorDateFormats
localboolean

Disposable

Methods

dispose()
dispose(): any;
Returns

any


FileSelectionParams

Properties

PropertyType
mimeTypes?string[]
single?boolean

MutexContext

Extends

Methods

exclusiveLock()
exclusiveLock<T>(promiseFn): Promise<T>;
Type Parameters
Type Parameter
T
Parameters
ParameterType
promiseFnPromiseFunction<T>
Returns

Promise<T>

sharedLock()
sharedLock<T>(promiseFn): Promise<T>;
Type Parameters
Type Parameter
T
Parameters
ParameterType
promiseFnSharedPromiseFunction<T>
Returns

Promise<T>

Inherited from

SharedMutexContext.sharedLock


SharedMutexContext

Extended by

Methods

sharedLock()
sharedLock<T>(promiseFn): Promise<T>;
Type Parameters
Type Parameter
T
Parameters
ParameterType
promiseFnSharedPromiseFunction<T>
Returns

Promise<T>

Type Aliases

IFunc

type IFunc<I, O> = (...args) => Promise<O>;

Type Parameters

Type Parameter
I extends any[]
O

Parameters

ParameterType
...argsI

Returns

Promise<O>


PromiseFunction

type PromiseFunction<T> = (context) => Promise<T>;

Type Parameters

Type Parameter
T

Parameters

ParameterType
contextMutexContext

Returns

Promise<T>


ReactorDateType

type ReactorDateType = Date | DateTime | string;

SharedPromiseFunction

type SharedPromiseFunction<T> = (context) => Promise<T>;

Type Parameters

Type Parameter
T

Parameters

ParameterType
contextSharedMutexContext

Returns

Promise<T>


Subscriber

type Subscriber<E> = {
handler: SubscriberCallback<E>;
id: string;
};

Type Parameters

Type Parameter
E

Properties

PropertyType
handlerSubscriberCallback<E>
idstring

SubscriberCallback

type SubscriberCallback<E> = (event) => void;

Type Parameters

Type Parameter
E

Parameters

ParameterType
eventE

Returns

void


ThrottleOptions

type ThrottleOptions = {
leading?: boolean;
wait_ms?: number;
};

Properties

PropertyType
leading?boolean
wait_ms?number

Variables

aHexToRgba

const aHexToRgba: (hex) => string & MemoizedFunction;

#11223344 => rgba(17, 34, 51, 0.27)


asColor

const asColor: (color) => ColorInstance & MemoizedFunction;

colorToAHex

const colorToAHex: (str) => string & MemoizedFunction;

same as rgbaToAHex, but can also work with colour names like 'mediumpurple'


colorToHex

const colorToHex: (str) => string & MemoizedFunction;

getDarkenedColor

const getDarkenedColor: (color, ratio) => any & MemoizedFunction;

getIntlNumberFormatter

const getIntlNumberFormatter: (maximumFractionDigits) => NumberFormat & MemoizedFunction;

getTransparentColor

const getTransparentColor: (color, transparency) => any & MemoizedFunction;

isColor

const isColor: (color) => boolean & MemoizedFunction;

normalizeColorToHex

const normalizeColorToHex: (color) => string & MemoizedFunction;

rgbaToAHex

const rgbaToAHex: (str) => string & MemoizedFunction;

rgba(17, 34, 51, 0.27) => #11223344

Functions

FunctionDescription
computeDateTimeParts-
copyTextToClipboard-
displayDateTime-
emailDomainsMatch-
formatNumber-
getColorWithAlphaOptions-
getEmailDomain-
parseDateTypesToLuxon-
readFileAsArrayBuffer-
readFileAsText-
retryWithBackoff-
saveFile-
selectFile-
selectFiles-
simpleDateTimeTakes any date as accepted by new Date(x) where x is the date and returns the date as a string in the format yyyy-mm-dd hh:mm:ss
throttleGiven an execution function, return a throttled execution function which executes a maximum of once every wait_ms.
toRelative-
trimStringIf the provided string is longer than the maximum length, the string is returned with an ellipse
validateEmail-