All files / src/internal/client/dev legacy.js

82.6% Statements 19/23
100% Branches 1/1
20% Functions 1/5
80% Lines 16/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 212x 2x 2x 2x 2x 169x 169x 169x 169x         169x 169x 169x 169x 169x 169x 169x  
import * as e from '../errors.js';
import { current_component_context } from '../runtime.js';
import { get_component } from './ownership.js';
 
export function legacy_api() {
	const component = current_component_context?.function;
 
	/** @param {string} method */
	function error(method) {
		// @ts-expect-error
		const parent = get_component()?.filename ?? 'Something';
		e.component_api_changed(parent, method, component.filename);
	}
 
	return {
		$destroy: () => error('$destroy()'),
		$on: () => error('$on(...)'),
		$set: () => error('$set(...)')
	};
}