thebe-core
Version:
Typescript based core functionality for Thebe
62 lines (61 loc) • 2.37 kB
TypeScript
import type { CellKind, IThebeCell, IThebeCellExecuteReturn, JsonObject } from './types';
import type ThebeSession from './session';
import PassiveCellRenderer from './passive';
import type { IRenderMimeRegistry } from '@jupyterlab/rendermime';
import type { Config } from './config';
import { EventEmitter } from './emitter';
import type { ICodeCell, IOutput } from '@jupyterlab/nbformat';
declare class ThebeCodeCell extends PassiveCellRenderer implements IThebeCell {
kind: CellKind;
source: string;
metadata: JsonObject;
session?: ThebeSession;
executionCount: number | null;
protected initialOutputs: IOutput[];
readonly notebookId: string;
protected busy: boolean;
protected events: EventEmitter;
constructor(id: string, notebookId: string, source: string, config: Config, metadata: JsonObject, rendermime: IRenderMimeRegistry);
static fromICodeCell(icc: ICodeCell, notebookId: string, config: Config, rendermime: IRenderMimeRegistry): ThebeCodeCell;
get isBusy(): boolean;
get isAttached(): boolean;
get tags(): string[];
/**
* Attaches to the session and adds the widgets factory to the rendermine registry
* call this version if using ThebeCell in isolation, otherwise call ThebeNotebook::attachSession
*
* @param session
*/
attachSession(session: ThebeSession): void;
/**
* Detaches from the session and removes the widgets factory from the rendermine registry
* call this version if using ThebeCell in isolation, otherwise call ThebeNotebook::detachSession
*
*/
detachSession(): void;
setAsBusy(): void;
setAsIdle(): void;
/**
* reset the DOM representation of the cell to the initial state
* along with the execution count
*
* @param hideWidgets boolean - if true, hide widgets
*/
initOutputs(initialOutputs: IOutput[]): void;
/**
* reset the DOM representation of the cell to the initial state
* along with the execution count
*
* @param hideWidgets boolean - if true, hide widgets
*/
reset(): void;
/**
* TODO
* - pass execute_count or timestamp or something back to redux on success/failure?
*
* @param source?
* @returns
*/
execute(source?: string): Promise<IThebeCellExecuteReturn | null>;
}
export default ThebeCodeCell;