Skip to content

Commit 28a167c

Browse files
committed
Require specifying the view to re-evaluate
1 parent 81c0a82 commit 28a167c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

interfaces/src/main/kotlin/com/noxcrew/interfaces/properties/LazyProperty.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public abstract class LazyProperty<T : Any>(
5252
public abstract suspend fun load(reload: Boolean = true): T
5353

5454
/** Initializes this property if it hasn't already. */
55-
public suspend fun initialize(view: InterfaceView? = null) {
55+
public suspend fun initialize(view: InterfaceView?) {
5656
if (!initialized || value == null) {
5757
reevaluate(reload = !initialized, view = view)
5858
}
@@ -63,10 +63,10 @@ public abstract class LazyProperty<T : Any>(
6363
* If [reload] is given, all data should be fully reloaded.
6464
*/
6565
public suspend fun reevaluate(
66+
view: InterfaceView?,
6667
reload: Boolean = true,
6768
trigger: Boolean = true,
6869
debounce: Duration = 200.milliseconds,
69-
view: InterfaceView? = null
7070
): T {
7171
// Mark down if we want an update to happen
7272
if (trigger) {

interfaces/src/main/kotlin/com/noxcrew/interfaces/properties/StateProperty.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public abstract class StateProperty(
3939
private var initialized: Boolean = false
4040

4141
/** Initializes this property if it hasn't already. */
42-
public suspend fun initialize(view: InterfaceView? = null) {
42+
public suspend fun initialize(view: InterfaceView?) {
4343
if (!initialized) {
4444
refresh(view = view)
4545
}
@@ -49,7 +49,7 @@ public abstract class StateProperty(
4949
* Refreshes this property, updating before triggering the state.
5050
* Ignored if last refresh was within [debounce].
5151
*/
52-
public suspend fun refresh(debounce: Duration = 200.milliseconds, view: InterfaceView? = null) {
52+
public suspend fun refresh(debounce: Duration = 200.milliseconds, view: InterfaceView?) {
5353
// Await any existing job if one is running
5454
if (updateJob != null) {
5555
updateJob?.await()

0 commit comments

Comments
 (0)