FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[1.20.4] Ref: Inline setting event functions by emyfops · Pull Request #104 · lambda-client/lambda · GitHub

[1.20.4] Ref: Inline setting event functions - #104

Merged
emyfops merged 1 commit into
masterfrom
refactor/settings
Feb 15, 2025
Merged

[1.20.4] Ref: Inline setting event functions#104
emyfops merged 1 commit into
masterfrom
refactor/settings

Conversation

emyfops commented Feb 14, 2025

Copy link
Copy Markdown
Contributor

This pull request changes the AbstractSetting event subscribers such as onValueChanged, onValueSet and others to facilitate subscription without having to wrap it in an apply block

Before:

private val mesh by setting("Mesh", true, "Connect similar adjacent blocks").apply { onValueSet(::rebuildMesh) }

After

private val mesh by setting("Mesh", true, "Connect similar adjacent blocks").onValueSet(::rebuildMesh)

Instead, we call apply in the event subscription event

fun onValueSet(block: (from: T, to: T) -> Unit) = apply {
    listeners.add(ValueListener(false, block))
}

github-actions Bot added triage Requires labelling or review 1.20 labels Feb 14, 2025
emyfops removed the triage Requires labelling or review label Feb 15, 2025

emyfops commented Feb 15, 2025

Copy link
Copy Markdown
Contributor Author

Tested, working

emyfops merged commit ca435be into master Feb 15, 2025
emyfops deleted the refactor/settings branch February 15, 2025 00:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL