mirror of
https://github.com/element-hq/element-call.git
synced 2026-11-23 15:30:02 +00:00
rename factory methods that return behaviors
This commit is contained in:
1 parent
9301043ef5
commit
74ff32e818
7 files changed
+16
-16
No files matched your search
@@ -64,7 +64,7 @@ import { type JoinCallData } from "../widget";
|
||||
import { MatrixRTCTransportMissingError } from "../utils/errors";
|
||||
import {
|
||||
BackgroundEffectsProvider,
|
||||
createAppBackgroundEffects,
|
||||
createAppBackgroundEffects$,
|
||||
} from "../tracks/BackgroundEffectsContext";
|
||||
import { MediaDevicesContext } from "../MediaDevicesContext";
|
||||
import { constant } from "../state/Behavior";
|
||||
@@ -198,7 +198,7 @@ function createCallView(
|
||||
<TooltipProvider>
|
||||
<MediaDevicesContext value={mockMediaDevices({})}>
|
||||
<BackgroundEffectsProvider
|
||||
effects={createAppBackgroundEffects(testScope())}
|
||||
effects={createAppBackgroundEffects$(testScope())}
|
||||
>
|
||||
{options.withErrorBoundary ? (
|
||||
<GroupCallErrorBoundary recoveryActionHandler={vi.fn()}>
|
||||
|
||||
@@ -51,7 +51,7 @@ import { AppBar } from "../AppBar";
|
||||
import { type MatrixInfo } from "./VideoPreview";
|
||||
import {
|
||||
BackgroundEffectsProvider,
|
||||
createAppBackgroundEffects,
|
||||
createAppBackgroundEffects$,
|
||||
} from "../tracks/BackgroundEffectsContext";
|
||||
import { initializeWidget } from "../widget";
|
||||
import { RootElementProvider } from "../RootElementContext";
|
||||
@@ -251,7 +251,7 @@ describe("ActiveCall", () => {
|
||||
<BrowserRouter>
|
||||
<MediaDevicesContext value={mediaDevices}>
|
||||
<BackgroundEffectsProvider
|
||||
effects={createAppBackgroundEffects(testScope())}
|
||||
effects={createAppBackgroundEffects$(testScope())}
|
||||
>
|
||||
<TooltipProvider>
|
||||
<ActiveCall
|
||||
@@ -302,7 +302,7 @@ describe("ActiveCall", () => {
|
||||
<RootElementProvider value={root}>
|
||||
<MediaDevicesContext value={mediaDevices}>
|
||||
<BackgroundEffectsProvider
|
||||
effects={createAppBackgroundEffects(testScope())}
|
||||
effects={createAppBackgroundEffects$(testScope())}
|
||||
>
|
||||
<TooltipProvider>
|
||||
<ActiveCall
|
||||
|
||||
@@ -8,7 +8,7 @@ Please see LICENSE in the repository root for full details.
|
||||
import { type ClientManager, type ClientSession } from "./ClientSession";
|
||||
import { type AudioOutputOptions, MediaDevices } from "./MediaDevices";
|
||||
import { type ObservableScope } from "./ObservableScope";
|
||||
import { createAppBackgroundEffects } from "../tracks/BackgroundEffectsContext";
|
||||
import { createAppBackgroundEffects$ } from "../tracks/BackgroundEffectsContext";
|
||||
|
||||
/**
|
||||
* The top-level state holder for the application.
|
||||
@@ -18,7 +18,7 @@ export class AppViewModel {
|
||||
this.scope,
|
||||
this.audioOutputOptions,
|
||||
);
|
||||
public readonly backgroundEffects = createAppBackgroundEffects(this.scope);
|
||||
public readonly backgroundEffects = createAppBackgroundEffects$(this.scope);
|
||||
|
||||
// TODO: Move more application logic here. The CallViewModel, at the very
|
||||
// least, ought to be accessible from this object.
|
||||
|
||||
@@ -11,7 +11,7 @@ import { type BackgroundProcessorWrapper } from "@livekit/track-processors";
|
||||
|
||||
import {
|
||||
type BackgroundEffects,
|
||||
createBackgroundEffects,
|
||||
createBackgroundEffects$,
|
||||
type BackgroundEffectsOptions,
|
||||
type BackgroundEffectsState,
|
||||
} from "./BackgroundEffects";
|
||||
@@ -72,7 +72,7 @@ describe("the pipeline's state", () => {
|
||||
const transformer = {
|
||||
onFirstFrame: undefined as (() => void) | undefined,
|
||||
};
|
||||
const effects = createBackgroundEffects(testScope(), {
|
||||
const effects = createBackgroundEffects$(testScope(), {
|
||||
supported: true,
|
||||
effect$: behavior(effect, { n: "none", b: "blur" }),
|
||||
setEffect: vi.fn(),
|
||||
@@ -116,7 +116,7 @@ describe("background effects", () => {
|
||||
function build(
|
||||
options: Partial<BackgroundEffectsOptions> = {},
|
||||
): BackgroundEffects {
|
||||
return createBackgroundEffects(testScope(), {
|
||||
return createBackgroundEffects$(testScope(), {
|
||||
supported: true,
|
||||
effect$,
|
||||
setEffect,
|
||||
|
||||
@@ -75,7 +75,7 @@ export interface BackgroundEffects {
|
||||
}
|
||||
|
||||
/** Switches the pipeline as the choice changes, for as long as the scope lasts. */
|
||||
export function createBackgroundEffects(
|
||||
export function createBackgroundEffects$(
|
||||
scope: ObservableScope,
|
||||
{
|
||||
supported,
|
||||
|
||||
@@ -12,7 +12,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
BackgroundEffectsProvider,
|
||||
useBackgroundEffects,
|
||||
createAppBackgroundEffects,
|
||||
createAppBackgroundEffects$,
|
||||
} from "./BackgroundEffectsContext";
|
||||
import {
|
||||
type BackgroundEffects,
|
||||
@@ -70,7 +70,7 @@ describe("BackgroundEffectsProvider", () => {
|
||||
let effects: BackgroundEffects | undefined;
|
||||
const surface = (): ReturnType<typeof createElement> =>
|
||||
createElement(BackgroundEffectsProvider, {
|
||||
effects: (effects ??= createAppBackgroundEffects(testScope())),
|
||||
effects: (effects ??= createAppBackgroundEffects$(testScope())),
|
||||
children: createElement(Surface),
|
||||
});
|
||||
const blur = async (on: boolean): Promise<void> => {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { type ObservableScope } from "../state/ObservableScope";
|
||||
import {
|
||||
type BackgroundEffects,
|
||||
type BackgroundEffectsState,
|
||||
createBackgroundEffects,
|
||||
createBackgroundEffects$,
|
||||
} from "../state/BackgroundEffects";
|
||||
import { useBehavior } from "../useBehavior";
|
||||
|
||||
@@ -48,13 +48,13 @@ export function useBackgroundEffectsState$(): Behavior<BackgroundEffectsState> {
|
||||
* and teardowns take their turns through the SDK, which runs one operation
|
||||
* at a time on a processor.
|
||||
*/
|
||||
export function createAppBackgroundEffects(
|
||||
export function createAppBackgroundEffects$(
|
||||
scope: ObservableScope,
|
||||
): BackgroundEffects {
|
||||
const transformer = new BackgroundEffectTransformer({
|
||||
backgroundDisabled: true,
|
||||
});
|
||||
return createBackgroundEffects(scope, {
|
||||
return createBackgroundEffects$(scope, {
|
||||
supported: supportsBackgroundProcessors(),
|
||||
effect$: backgroundEffectSetting.value$,
|
||||
setEffect: backgroundEffectSetting.setValue,
|
||||
|
||||
Reference in new issue
Block a user