File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " js-element" ,
3- "version" : " 0.0.228 " ,
3+ "version" : " 0.0.229 " ,
44 "description" : " " ,
55 "license" : " LGPL-3.0" ,
66 "main" : " ./index.js" ,
Original file line number Diff line number Diff line change @@ -307,12 +307,35 @@ export const useAfterMount = hook(
307307 }
308308)
309309
310- // === useBeforeUpdate ===================================================
310+ // === useBeforeRender ===============================================
311+
312+ export const useBeforeRender = hook (
313+ 'useBeforeRender' ,
314+ function ( action : ( ) => void | undefined | null | ( ( ) => void ) ) {
315+ let cleanup : Task | null | undefined | void = null
316+ const c = currentCtrl !
317+
318+ const task = ( ) => {
319+ cleanup && cleanup ( )
320+ cleanup = action ( )
321+ }
322+
323+ c . beforeMount ( task )
324+ c . beforeUpdate ( task )
325+
326+ c . beforeUnmount ( ( ) => {
327+ cleanup && cleanup ( )
328+ cleanup = null
329+ } )
330+ }
331+ )
332+
333+ // === useBeforeUpdate ===============================================
311334
312335export const useBeforeUpdate = hook (
313336 'useBeforeUpdate' ,
314337 function ( action : ( ) => void | undefined | null | ( ( ) => void ) ) {
315- let cleanup : Task | null | undefined | void
338+ let cleanup : Task | null | undefined | void = null
316339 const c = currentCtrl !
317340
318341 c . beforeUpdate ( ( ) => {
@@ -322,6 +345,7 @@ export const useBeforeUpdate = hook(
322345
323346 c . beforeUnmount ( ( ) => {
324347 cleanup && cleanup ( )
348+ cleanup = null
325349 } )
326350 }
327351)
You can’t perform that action at this time.
0 commit comments