mim-tsplay
Version:
TypeScript playground with Monaco editor, compilation and HTML presentation
41 lines (40 loc) • 1.72 kB
TypeScript
import { IExampleInfo, IExtraLibInfo, ICodeSnippetInfo } from "./PlaygroundConfig";
import "monaco-editor/esm/vs/basic-languages/javascript/javascript";
import "monaco-editor/esm/vs/basic-languages/typescript/typescript";
import "monaco-editor/esm/vs/language/typescript/tsMode";
/**
* The IPlaygroundExtension interface represents an object that provides additional features to the
* playground. These features include custom code snippets, help items and others.
*/
export interface IPlaygroundExtension {
/**
* Returns a list of extra library objects providing information about type files that will
* be added to the editor for type checking.
*/
getExtraLibs(): IExtraLibInfo[];
/**
* Returns a list of examples.
*/
getExamples(): IExampleInfo[];
/**
* Returns a list of code snippets. Extensions can provide regular template-based snippets, but
* they can also implement custom snippets with arbitrary UI.
*/
getCodeSnippets(): ICodeSnippetInfo[];
}
/**
* The IPlaygroundExtnsionClass interface represents a constructor that creates IPlaygroundExtension
* objects.
*/
export interface IPlaygroundExtensionClass {
new (): IPlaygroundExtension;
/** User friendly extension name */
readonly displayName: string;
}
/**
* Registers the given extensions
* @param extensionClass Constuctor interface representing the extension class.
* @returns True if the extension was successfully registered and false otherwise. False is
* returned if the extension tries to register itself multiple times.
*/
export declare function registerExtension(extensionClass: IPlaygroundExtensionClass): boolean;