@@ -767,55 +767,44 @@ export function applyOptions(
767
767
globalMixins
768
768
)
769
769
}
770
-
if (beforeMount) {
771
-
onBeforeMount(beforeMount.bind(publicThis))
772
-
}
773
-
if (mounted) {
774
-
onMounted(mounted.bind(publicThis))
775
-
}
776
-
if (beforeUpdate) {
777
-
onBeforeUpdate(beforeUpdate.bind(publicThis))
778
-
}
779
-
if (updated) {
780
-
onUpdated(updated.bind(publicThis))
781
-
}
782
-
if (activated) {
783
-
onActivated(activated.bind(publicThis))
784
-
}
785
-
if (deactivated) {
786
-
onDeactivated(deactivated.bind(publicThis))
787
-
}
788
-
if (errorCaptured) {
789
-
onErrorCaptured(errorCaptured.bind(publicThis))
790
-
}
791
-
if (renderTracked) {
792
-
onRenderTracked(renderTracked.bind(publicThis))
793
-
}
794
-
if (renderTriggered) {
795
-
onRenderTriggered(renderTriggered.bind(publicThis))
796
-
}
797
-
if (beforeUnmount) {
798
-
onBeforeUnmount(beforeUnmount.bind(publicThis))
799
-
}
800
-
if (unmounted) {
801
-
onUnmounted(unmounted.bind(publicThis))
802
-
}
803
-
if (serverPrefetch) {
804
-
onServerPrefetch(serverPrefetch.bind(publicThis))
770
+
771
+
function registerLifecycleHook(
772
+
register: Function,
773
+
hook?: Function | Function[]
774
+
) {
775
+
// Array lifecycle hooks are only present in the compat build
776
+
if (__COMPAT__ && isArray(hook)) {
777
+
hook.forEach(_hook => register(_hook.bind(publicThis)))
778
+
} else if (hook) {
779
+
register((hook as Function).bind(publicThis))
780
+
}
805
781
}
806
782
783
+
registerLifecycleHook(onBeforeMount, beforeMount)
784
+
registerLifecycleHook(onMounted, mounted)
785
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate)
786
+
registerLifecycleHook(onUpdated, updated)
787
+
registerLifecycleHook(onActivated, activated)
788
+
registerLifecycleHook(onDeactivated, deactivated)
789
+
registerLifecycleHook(onErrorCaptured, errorCaptured)
790
+
registerLifecycleHook(onRenderTracked, renderTracked)
791
+
registerLifecycleHook(onRenderTriggered, renderTriggered)
792
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount)
793
+
registerLifecycleHook(onUnmounted, unmounted)
794
+
registerLifecycleHook(onServerPrefetch, serverPrefetch)
795
+
807
796
if (__COMPAT__) {
808
797
if (
809
798
beforeDestroy &&
810
799
softAssertCompatEnabled(DeprecationTypes.OPTIONS_BEFORE_DESTROY, instance)
811
800
) {
812
-
onBeforeUnmount(beforeDestroy.bind(publicThis))
801
+
registerLifecycleHook(onBeforeUnmount, beforeDestroy)
813
802
}
814
803
if (
815
804
destroyed &&
816
805
softAssertCompatEnabled(DeprecationTypes.OPTIONS_DESTROYED, instance)
817
806
) {
818
-
onUnmounted(destroyed.bind(publicThis))
807
+
registerLifecycleHook(onUnmounted, destroyed)
819
808
}
820
809
}
821
810
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4