diff --git a/app/packages/core/src/plugins/SchemaIO/components/TimerView.tsx b/app/packages/core/src/plugins/SchemaIO/components/TimerView.tsx index 6980c500e35..b098c02035e 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/TimerView.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/TimerView.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef } from "react"; +import { useEffect, useRef } from "react"; import { usePanelEvent } from "@fiftyone/operators"; import { usePanelId } from "@fiftyone/spaces"; import { ViewPropsType } from "../utils/types"; @@ -8,6 +8,7 @@ export type TimerViewParams = { on_timeout?: string; interval?: number; timeout?: number; + params?: object; }; class Timer { @@ -47,7 +48,13 @@ class TimeoutTimer extends Timer { function useTimer(params: TimerViewParams) { const panelId = usePanelId(); const triggerEvent = usePanelEvent(); - const { on_interval, interval, timeout, on_timeout } = params; + const { + on_interval, + interval, + timeout, + on_timeout, + params: operator_params, + } = params; const ref = useRef(null); useEffect(() => { @@ -64,7 +71,7 @@ function useTimer(params: TimerViewParams) { if (on_interval) { triggerEvent(panelId, { operator: on_interval, - params: {}, + params: operator_params || {}, prompt: null, }); } @@ -73,7 +80,7 @@ function useTimer(params: TimerViewParams) { if (on_timeout) { triggerEvent(panelId, { operator: on_timeout, - params: {}, + params: operator_params || {}, prompt: null, }); } diff --git a/fiftyone/operators/types.py b/fiftyone/operators/types.py index 50924b56d2e..6a873b03d0a 100644 --- a/fiftyone/operators/types.py +++ b/fiftyone/operators/types.py @@ -2814,6 +2814,7 @@ class TimerView(View): interval (None): the interval in milliseconds to wait before executing the operator on_timeout (None): the operator to execute when the timeout is reached on_interval (None): the operator to execute at the interval + params (None): the params passed to the on_interval or on_timeout operator """ def __init__(self, **kwargs):