Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcfefe0

Browse files
committed
feat(soba/abstractions): rename injectHelper to helper
1 parent b30cb10 commit bcfefe0

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

libs/soba/abstractions/src/lib/helper.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Object3D } from 'three';
1616

1717
type HelperArgs<T> = T extends [infer _, ...infer R] ? R : never;
1818

19-
export function injectHelper<
19+
export function helper<
2020
TConstructor extends new (...args: any[]) => THREE.Object3D,
2121
THelperInstance extends InstanceType<TConstructor> & { update: () => void; dispose: () => void },
2222
>(
@@ -27,7 +27,7 @@ export function injectHelper<
2727
args = () => [] as unknown as HelperArgs<ConstructorParameters<TConstructor>>,
2828
}: { injector?: Injector; args?: () => HelperArgs<ConstructorParameters<TConstructor>> } = {},
2929
) {
30-
return assertInjector(injectHelper, injector, () => {
30+
return assertInjector(helper, injector, () => {
3131
const store = injectStore();
3232

3333
const helper = computed(() => {
@@ -65,6 +65,12 @@ export function injectHelper<
6565
});
6666
}
6767

68+
/**
69+
* @deprecated use helper instead. Will be removed in v5.0.0
70+
* @since v4.0.0
71+
*/
72+
export const injectHelper = helper;
73+
6874
@Component({
6975
selector: 'ngts-helper',
7076
template: `
@@ -89,7 +95,7 @@ export class NgtsHelper<TConstructor extends new (...args: any[]) => THREE.Objec
8995
return instanceState.parent() as unknown as THREE.Object3D;
9096
});
9197

92-
helper = injectHelper(this.parent, this.type, { args: this.options });
98+
helper = helper(this.parent, this.type, { args: this.options });
9399

94100
constructor() {
95101
extend({ Object3D });

libs/soba/src/performances/bvh.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@angular/core';
1111
import { Meta } from '@storybook/angular';
1212
import { beforeRender, NgtArgs, NgtThreeElements } from 'angular-three';
13-
import { injectHelper } from 'angular-three-soba/abstractions';
13+
import { helper } from 'angular-three-soba/abstractions';
1414
import { NgtsOrbitControls } from 'angular-three-soba/controls';
1515
import { NgtsBVH } from 'angular-three-soba/performances';
1616
import * as THREE from 'three';
@@ -44,7 +44,7 @@ class TorusBVH {
4444
protected color = signal('#ff0000');
4545

4646
constructor() {
47-
injectHelper(this.meshRef, () => MeshBVHHelper);
47+
helper(this.meshRef, () => MeshBVHHelper);
4848
}
4949
}
5050

libs/soba/staging/src/lib/caustics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
viewChild,
1010
} from '@angular/core';
1111
import { beforeRender, extend, getInstanceState, NgtThreeElements, omit, pick, resolveRef } from 'angular-three';
12-
import { injectHelper, NgtsEdges } from 'angular-three-soba/abstractions';
12+
import { helper, NgtsEdges } from 'angular-three-soba/abstractions';
1313
import { fbo } from 'angular-three-soba/misc';
1414
import { CausticsProjectionMaterial, createCausticsUpdate } from 'angular-three-soba/vanilla-exports';
1515
import { mergeInputs } from 'ngxtension/inject-inputs';
@@ -158,7 +158,7 @@ export class NgtsCaustics {
158158
protected causticsTarget = fbo(this.causticsTargetParams);
159159
protected causticsTargetB = fbo(this.causticsTargetParams);
160160

161-
private cameraHelper = injectHelper(
161+
private cameraHelper = helper(
162162
() => (this.debug() ? this.cameraRef().nativeElement : null),
163163
() => THREE.CameraHelper,
164164
);

0 commit comments

Comments
 (0)