Skip to content

Commit b9cd35a

Browse files
committed
fix(core): add created event
1 parent 0a561c7 commit b9cd35a

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Diff for: libs/core/src/lib/renderer/renderer.ts

+5
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,11 @@ export class NgtRenderer2 implements Renderer2 {
625625
return () => {};
626626
}
627627

628+
if (eventName === 'created') {
629+
callback(target);
630+
return () => {};
631+
}
632+
628633
if (eventName === 'attached') {
629634
iS.onAttach = callback;
630635
const parent = iS.parent && untracked(iS.parent);

Diff for: libs/core/src/lib/three-types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export type ThreeChildRemovedEvent = { type: 'childremoved'; target: any; child:
6161
export interface NgtNodeEventMap<TInstance = NgtAnyRecord> {
6262
attached: NgtAfterAttach<TInstance, any>;
6363
updated: TInstance;
64+
created: TInstance;
6465
// NOTE: this is named "disposed" to differentiate it from [dispose] property.
6566
disposed: ThreeDisposeEvent;
6667
}

Diff for: tools/scripts/json/common-attributes.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ export const COMMON_EVENTS = [
5050
type: 'any',
5151
description: 'Fires when the element is updated with the updated instance',
5252
},
53+
{
54+
name: '(created)',
55+
type: 'any',
56+
description: 'Fires when the element is created with the created instance',
57+
},
5358
];
5459

5560
export const OBJECT3D_EVENTS = [

0 commit comments

Comments
 (0)