1 package expo.modules.devlauncher.launcher 2 3 import com.facebook.react.ReactActivity 4 import java.util.LinkedList 5 6 typealias DevLauncherDelegateWillBeCreated = (ReactActivity) -> Unit 7 8 /** 9 * This class encapsulate all lifecycle methods related to the DevelopmentClient instance and loaded apps. 10 */ 11 class DevLauncherLifecycle { 12 private val delegateWillBeCreatedListeners = LinkedList<DevLauncherDelegateWillBeCreated>() 13 delegateWillBeCreatednull14 fun delegateWillBeCreated(activity: ReactActivity) { 15 delegateWillBeCreatedListeners.forEach { 16 it.invoke(activity) 17 } 18 } 19 addListenernull20 fun addListener(listener: DevLauncherDelegateWillBeCreated) { 21 delegateWillBeCreatedListeners.add(listener) 22 } 23 removeListenernull24 fun removeListener(listener: DevLauncherDelegateWillBeCreated) { 25 delegateWillBeCreatedListeners.remove(listener) 26 } 27 } 28