remove buffers.expanding()

according to the docs, this is the default
This commit is contained in:
David Lechner
2020-06-10 21:59:34 -05:00
committed by David Lechner
parent 61a5eb6039
commit 367d8a6178
2 changed files with 9 additions and 12 deletions
+5 -7
View File
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors
import { Channel, buffers } from 'redux-saga';
import { Channel } from 'redux-saga';
import { actionChannel, fork, put, take, takeEvery } from 'redux-saga/effects';
import { Action } from '../actions';
import {
@@ -51,12 +51,10 @@ import { hex } from '../utils';
function* encodeRequest(): Generator {
// Using a while loop to serialize sending data to avoid "busy" errors.
const chan = (yield actionChannel(
(a: Action) =>
Object.values(BootloaderRequestActionType).includes(
a.type as BootloaderRequestActionType,
),
buffers.expanding(),
const chan = (yield actionChannel((a: Action) =>
Object.values(BootloaderRequestActionType).includes(
a.type as BootloaderRequestActionType,
),
)) as Channel<BootloaderRequestAction>;
while (true) {
const action = (yield take(chan)) as BootloaderRequestAction;
+4 -5
View File
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors
import { Channel, buffers } from 'redux-saga';
import { Channel } from 'redux-saga';
import {
actionChannel,
delay,
@@ -24,10 +24,9 @@ const encoder = new TextEncoder();
const terminalDataSource = new PushStream<string>();
function* receiveTerminalData(): Generator {
const channel = (yield actionChannel(
TerminalActionType.ReceivedData,
buffers.expanding(),
)) as Channel<TerminalDataReceiveDataAction>;
const channel = (yield actionChannel(TerminalActionType.ReceivedData)) as Channel<
TerminalDataReceiveDataAction
>;
while (true) {
// wait for input from terminal
const action = (yield take(channel)) as TerminalDataReceiveDataAction;