This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@class MSNotificationHub; | |
@class MSInstallation; | |
@protocol MSInstallationEnrichmentDelegate <NSObject> | |
@optional | |
- (void)notificationHub:(MSNotificationHub *)notificationHub willEnrichInstallation:(MSInstallation *)installation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AsyncIterableX } from '../asynciterablex'; | |
import { OperatorAsyncFunction } from '../../interfaces'; | |
import { wrapWithAbort } from './withabort'; | |
import { throwIfAborted } from '../../aborterror'; | |
import { identity } from '../../util/identity'; | |
// eslint-disable-next-line @typescript-eslint/no-empty-function | |
const NEVER_PROMISE = new Promise(() => {}); | |
type MergeResult<T> = { value: T; index: number }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { identity, identityAsync } from '../util/identity'; | |
import { wrapWithAbort } from './operators/withabort'; | |
// eslint-disable-next-line @typescript-eslint/no-empty-function | |
const NEVER_PROMISE = new Promise(() => {}); | |
type MergeResult<T> = { value: T; index: number }; | |
function wrapPromiseWithIndex<T>(promise: Promise<T>, index: number) { | |
return promise.then(value => ({ value, index })) as Promise<MergeResult<T>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { identityAsync } from '../util/identity'; | |
import { wrapWithAbort } from './operators/withabort'; | |
import { throwIfAborted } from '../aborterror'; | |
/** | |
* The options for calculating an average. | |
* | |
* @export | |
* @interface AverageOptions | |
* @template T The type of elements in the source sequence. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AsyncIterableX } from './asynciterablex'; | |
import { throwIfAborted, AbortError } from '../aborterror'; | |
export class NeverAsyncIterable extends AsyncIterableX<never> { | |
constructor() { | |
super(); | |
} | |
async *[Symbol.asyncIterator](signal?: AbortSignal) { | |
throwIfAborted(signal); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AbortSignal } from '../../abortsignal'; | |
import { AsyncIterableX } from '../asynciterablex'; | |
import { MonoTypeOperatorAsyncFunction } from '../../interfaces'; | |
import { wrapWithAbort } from './withabort'; | |
import { AbortError } from '../../aborterror'; | |
async function forEach<T>( | |
source: AsyncIterable<T>, | |
fn: (item: T, signal?: AbortSignal) => void | Promise<void>, | |
signal?: AbortSignal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ReduceOptions } from './reduceoptions'; | |
import { wrapWithAbort } from './operators/withabort'; | |
export async function reduce<T, R = T>( | |
source: AsyncIterable<T>, | |
options: ReduceOptions<T, R> | |
): Promise<R> { | |
const { seed, signal, callback } = options; | |
const hasSeed = options.hasOwnProperty('seed'); | |
let i = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AbortError } from '../aborterror'; | |
export function sleep(dueTime: number, signal?: AbortSignal) { | |
return new Promise<void>((resolve, reject) => { | |
if (signal?.aborted) { | |
reject(new AbortError()); | |
} | |
const id = setTimeout(() => { | |
if (signal?.aborted) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class AbortError extends Error { | |
constructor() { | |
super(); | |
Object.setPrototypeOf(this, AbortError.prototype); | |
this.message = 'The operation has been aborted'; | |
} | |
} | |
export function throwIfAborted(signal?: AbortSignal) { | |
if (signal?.aborted) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @name Rx | |
* @type Object | |
*/ | |
var Rx = { Internals: {} }; | |
/** | |
* @name CompositeDisposable | |
* @constructor | |
* @memberOf Rx |