import type { Feature } from './types'; /** * An object to specify attributes of the feature. * * @public */ export interface MakeFeatureParams { /** {@inheritDoc AssembledFeature.script} */ readonly script: string; /** {@inheritDoc AssembledFeature.identifier} */ readonly identifier: string; /** {@inheritDoc AssembledFeature.eventHandlerName} */ readonly eventHandlerName: E; /** {@inheritDoc AssembledFeature.payloadType} */ readonly payloadType?: P; } /** * Create a feature. * * @param params - An object to specify attributes of the feature. * * @public */ export function makeFeature({ script, identifier, eventHandlerName, payloadType }: MakeFeatureParams): Feature { return { identifier, eventHandlerName, assemble: (options: Partial = {}) => ({ script, identifier, eventHandlerName, payloadType, options: options }) }; }