rxjs#Subject TypeScript Examples

The following examples show how to use rxjs#Subject. 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: watch-assets.ts    From codedoc with MIT License 6 votes vote down vote up
export function watchAssets(root: string, config: CodedocConfig, state: BehaviorSubject<{status: Status}>) {
  const change$ = new Subject<string>();

  watch(join(root, config.dest.assets), {
    recursive: true,
    filter: f => ASSET_EXTENSIONS.some(extension => f.toLowerCase().endsWith(extension))
  }, (_, filename) => change$.next(filename));

  return change$.pipe(
    debounceTime(10),
    filter(() => state.value.status !== StatusBuildingResponse)
  );
}
Example #2
Source File: TargetMovement.ts    From grid-engine with Apache License 2.0 6 votes vote down vote up
constructor(
    private character: GridCharacter,
    private tilemap: GridTilemap,
    private targetPos: LayerPosition,
    {
      numberOfDirections = NumberOfDirections.FOUR,
      config,
      ignoreBlockedTarget = false,
      distance = 0,
    }: Options = {}
  ) {
    this.ignoreBlockedTarget = ignoreBlockedTarget;
    this.distance = distance;
    this.noPathFoundStrategy =
      config?.noPathFoundStrategy || NoPathFoundStrategy.STOP;
    this.pathBlockedStrategy =
      config?.pathBlockedStrategy || PathBlockedStrategy.WAIT;
    this.noPathFoundRetryable = new Retryable(
      config?.noPathFoundRetryBackoffMs || 200,
      config?.noPathFoundMaxRetries || -1,
      () => {
        this.stop(MoveToResult.NO_PATH_FOUND_MAX_RETRIES_EXCEEDED);
      }
    );
    this.pathBlockedRetryable = new Retryable(
      config?.pathBlockedRetryBackoffMs || 200,
      config?.pathBlockedMaxRetries || -1,
      () => {
        this.stop(MoveToResult.PATH_BLOCKED_MAX_RETRIES_EXCEEDED);
      }
    );
    this.distanceUtils = DistanceUtilsFactory.create(numberOfDirections);
    this.pathBlockedWaitTimeoutMs = config?.pathBlockedWaitTimeoutMs || -1;
    this.finished$ = new Subject<Finished>();
    this.setCharacter(character);
  }
Example #3
Source File: bridge-bottom-form.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    public readonly swapFormService: SwapFormService,
    private readonly cdr: ChangeDetectorRef,
    private readonly bridgeService: BridgeService,
    private readonly errorsService: ErrorsService,
    private readonly settingsService: SettingsService,
    private readonly authService: AuthService,
    @Inject(TuiDialogService) private readonly dialogService: TuiDialogService,
    private readonly destroy$: TuiDestroyService,
    @Inject(Injector) private readonly injector: Injector,
    private readonly translateService: TranslateService,
    private readonly tokensService: TokensService,
    private readonly notificationsService: NotificationsService,
    private readonly counterNotificationsService: CounterNotificationsService,
    private readonly successTxModalService: SuccessTxModalService,
    private readonly iframeService: IframeService,
    private readonly gtmService: GoogleTagManagerService,
    @Inject(WINDOW) private readonly window: RubicWindow
  ) {
    this.onCalculateTrade$ = new Subject<void>();
  }
Example #4
Source File: GridEngine.ts    From grid-engine with Apache License 2.0 6 votes vote down vote up
/**
   * Initializes GridEngine. Must be called before any other methods of
   * GridEngine are called.
   */
  create(tilemap: Phaser.Tilemaps.Tilemap, config: GridEngineConfig): void {
    this.isCreated = true;
    this.gridCharacters = new Map();

    const concreteConfig = this.setConfigDefaults(config);

    GlobalConfig.set(concreteConfig);
    this.movementStopped$ = new Subject<{
      charId: string;
      direction: Direction;
    }>();
    this.movementStarted$ = new Subject<{
      charId: string;
      direction: Direction;
    }>();
    this.directionChanged$ = new Subject<{
      charId: string;
      direction: Direction;
    }>();
    this.positionChangeStarted$ = new Subject<
      { charId: string } & PositionChange
    >();
    this.positionChangeFinished$ = new Subject<
      { charId: string } & PositionChange
    >();
    this.charRemoved$ = new Subject<string>();
    this.charAdded$ = new Subject<string>();
    this.gridTilemap = new GridTilemap(tilemap);

    this.addCharacters();
  }
Example #5
Source File: confirm-secret-password.component.ts    From xBull-Wallet with GNU Affero General Public License v3.0 5 votes vote down vote up
componentDestroyed$: Subject<void> = new Subject<void>();
Example #6
Source File: wallet-connector.service.ts    From rubic-app with GNU General Public License v3.0 5 votes vote down vote up
private readonly _transactionEmitter$ = new Subject<void>();
Example #7
Source File: da-layout.component.ts    From ng-devui-admin with MIT License 5 votes vote down vote up
private destroy$ = new Subject();
Example #8
Source File: manager.component.ts    From RcloneNg with MIT License 5 votes vote down vote up
private pasteTrigger = new Subject<IManipulate[]>();
Example #9
Source File: theme.service.ts    From angular-electron-admin with Apache License 2.0 5 votes vote down vote up
themeSubject: Subject<string> = new Subject<string>();
Example #10
Source File: pages.component.ts    From ng-devui-admin with MIT License 5 votes vote down vote up
private destroy$ = new Subject();
Example #11
Source File: bridge-bottom-form.component.ts    From rubic-app with GNU General Public License v3.0 5 votes vote down vote up
private readonly onCalculateTrade$: Subject<void>;
Example #12
Source File: product-detail.component.ts    From Angular-ActionStreams with MIT License 5 votes vote down vote up
// Error messages
  private errorMessageSubject = new Subject<string>();
Example #13
Source File: layout-col.component.ts    From ng-devui-admin with MIT License 5 votes vote down vote up
private destroy$ = new Subject();