Skip to content

Commit 8098fb1

Browse files
Added definitions for new viewport related lifecycle hooks.
1 parent 76f0c6d commit 8098fb1

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/component.d.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ declare namespace Component {
113113
ready?: (this: ComponentInstance) => void
114114
/**
115115
* Triggers when the Component receives focus.
116+
*
116117
* This event can fire multiple times during the component's lifecycle
117118
*/
118119
focus?: (this: ComponentInstance) => void
119120
/**
120121
* Triggers when the Component loses focus.
122+
*
121123
* This event can fire multiple times during the component's lifecycle
122124
*/
123125
unfocus?: (this: ComponentInstance) => void
@@ -130,7 +132,31 @@ declare namespace Component {
130132
*
131133
* Note: This hook will fire continuously, multiple times per second!
132134
*/
133-
frameTick?: (this: ComponentInstance) => void
135+
frameTick?: (this: ComponentInstance) => void,
136+
/**
137+
* Fires when the component enters the viewport _margin_ and is attached to the render tree
138+
*
139+
* This event can fire multiple times during the component's lifecycle
140+
*/
141+
attach?: (this: ComponentInstance) => void,
142+
/**
143+
* Fires when the component leaves the viewport _margin_ and is detached from the render tree
144+
*
145+
* This event can fire multiple times during the component's lifecycle
146+
*/
147+
detach?: (this: ComponentInstance) => void,
148+
/**
149+
* Fires when the component enters the visible viewport
150+
*
151+
* This event can fire multiple times during the component's lifecycle
152+
*/
153+
enter?: (this: ComponentInstance) => void,
154+
/**
155+
* Fires when the component leaves the visible viewport
156+
*
157+
* This event can fire multiple times during the component's lifecycle
158+
*/
159+
exit?: (this: ComponentInstance) => void,
134160
}
135161

136162
export interface ComponentInstance {

0 commit comments

Comments
 (0)