frontispiece / packages / ink-processor / src / engine / plugin.ts
plugin.ts
Raw
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

import { Command } from '../data/command';
import { VisualInkLine } from '../types';

export interface PluginEngine {
	registerCommand(commandName: string, command: Command): void
	changeLineParser(newParser: (line: string) => VisualInkLine): void
	resetLineParser(): void
}

export interface Plugin {
	/**
	 * Initializes the plugin.
	 * Any modifications to the engine, changes, command registrations, etc. should go here.
	 * @param engine 
	 */
	initialize(engine: PluginEngine): void
}