Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makeScene2D anywhere #2

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
chore: remove old parametrize code
hkonsti committed Mar 18, 2024
commit 2c3f8c7e65028bbe277f4825f98286995bb554c7
31 changes: 0 additions & 31 deletions packages/2d/src/lib/scenes/makeScene2D.ts
Original file line number Diff line number Diff line change
@@ -22,34 +22,3 @@ export function makeScene2D(runner: ThreadGeneratorFactory<View2D>) {
*/
} as unknown as FullSceneDescription;
}

/*type CyclicConfig<T> = (params: T) => CyclicConfig<T>;

export function parametrize<T>(scene: FullSceneDescription, params: T) {
const typeScene = scene as FullSceneDescription<CyclicConfig<T>>;
const newScene = {
...typeScene,
config: typeScene.config(params),
onReplaced: new ValueDispatcher(typeScene),
};

typeScene.onReplaced.subscribe(value => {
newScene.onReplaced.current = {
...newScene,
config: value.config(params),
};
}, false);

return newScene;
}

export function makeParametrizedScene<T>(
factory: (view: View2D, params: T) => ThreadGenerator,
) {
return makeScene2D(
((params: T) =>
function* (view: View2D) {
yield* factory(view, params);
}) as unknown as ThreadGeneratorFactory<View2D>,
);
}*/