mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-14 16:10:59 -07:00
23 lines
552 B
TypeScript
23 lines
552 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import React, { createContext } from 'react';
|
|
import type { StreamingState } from '../types.js';
|
|
|
|
export const StreamingContext = createContext<StreamingState | undefined>(
|
|
undefined,
|
|
);
|
|
|
|
export const useStreamingContext = (): StreamingState => {
|
|
const context = React.useContext(StreamingContext);
|
|
if (context === undefined) {
|
|
throw new Error(
|
|
'useStreamingContext must be used within a StreamingContextProvider',
|
|
);
|
|
}
|
|
return context;
|
|
};
|