rxjs#SchedulerLike TypeScript Examples

The following examples show how to use rxjs#SchedulerLike. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: scheduled.d.ts    From amazon-kinesis-video-streams-webrtc-sdk-js-with-amazon-cognito with MIT No Attribution 6 votes vote down vote up
/**
 * Converts from a common {@link ObservableInput} type to an observable where subscription and emissions
 * are scheduled on the provided scheduler.
 *
 * @see from
 * @see of
 *
 * @param input The observable, array, promise, iterable, etc you would like to schedule
 * @param scheduler The scheduler to use to schedule the subscription and emissions from
 * the returned observable.
 */
export declare function scheduled<T>(input: ObservableInput<T>, scheduler: SchedulerLike): Observable<T>;
Example #2
Source File: scheduled.ts    From amazon-kinesis-video-streams-webrtc-sdk-js-with-amazon-cognito with MIT No Attribution 6 votes vote down vote up
/**
 * Converts from a common {@link ObservableInput} type to an observable where subscription and emissions
 * are scheduled on the provided scheduler.
 *
 * @see from
 * @see of
 *
 * @param input The observable, array, promise, iterable, etc you would like to schedule
 * @param scheduler The scheduler to use to schedule the subscription and emissions from
 * the returned observable.
 */
export function scheduled<T>(input: ObservableInput<T>, scheduler: SchedulerLike): Observable<T> {
  if (input != null) {
    if (isInteropObservable(input)) {
      return scheduleObservable(input, scheduler);
    } else if (isPromise(input)) {
      return schedulePromise(input, scheduler);
    } else if (isArrayLike(input)) {
      return scheduleArray(input, scheduler);
    }  else if (isIterable(input) || typeof input === 'string') {
      return scheduleIterable(input, scheduler);
    }
  }

  throw new TypeError((input !== null && typeof input || input) + ' is not observable');
}
Example #3
Source File: pdf.service.ts    From nestjs-pdf with MIT License 6 votes vote down vote up
toFile(
        template: string,
        filename: string,
        options?: PDFOptions,
        scheduler: SchedulerLike = asapScheduler,
    ): Observable<FileInfo> {
        return this.makeHtmlRender(template, options).pipe(
            mergeMap((html: string) => {
                const create = this.create(html, options);
                return bindNodeCallback<
                    [string | undefined],
                    [FileInfo]
                >(
                    create.toFile.bind(create),
                    scheduler,
                )(filename);
            }),
        );
    }
Example #4
Source File: pdf.service.ts    From nestjs-pdf with MIT License 6 votes vote down vote up
toStream(
        template: string,
        options?: PDFOptions,
        scheduler: SchedulerLike = asapScheduler,
    ): Observable<Readable> {
        return this.makeHtmlRender(template, options).pipe(
            mergeMap((html: string) => {
                const create = this.create(html, options);
                return bindNodeCallback<[], [Readable]>(
                    create.toStream.bind(create),
                    scheduler,
                )();
            }),
        );
    }
Example #5
Source File: pdf.service.ts    From nestjs-pdf with MIT License 6 votes vote down vote up
toBuffer(
        template: string,
        options?: PDFOptions,
        scheduler: SchedulerLike = asapScheduler,
    ): Observable<Buffer> {
        return this.makeHtmlRender(template, options).pipe(
            mergeMap((html: string) => {
                const create = this.create(html, options);
                return bindNodeCallback<[], [Buffer]>(
                    create.toBuffer.bind(create),
                    scheduler,
                )();
            }),
        );
    }
Example #6
Source File: app.service.ts    From nestjs-pdf with MIT License 6 votes vote down vote up
generatePDFToFile(
        template: string,
        filename: string,
        options?: PDFOptions,
        scheduler?: SchedulerLike,
    ): Observable<FileInfo> {
        return this.pdfService.toFile(
            template,
            filename,
            options,
            scheduler,
        );
    }