Simplify service lookups with optional chaining
The bar-null-shell-null-typeof-function ternary guarded against our own shell missing a method it always defines. bar?.shell?.firstPartyServiceFor() handles the only real case, delayed bar injection, in one line. The typeof checks that probe genuinely third-party plugin objects stay. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
ba91bad3a4
commit
289e6d12fc
@@ -7,7 +7,7 @@ BarWidget {
|
||||
id: root
|
||||
moduleName: "omarchy.media"
|
||||
|
||||
readonly property var mediaService: bar && bar.shell ? bar.shell.firstPartyServiceFor("omarchy.media") : null
|
||||
readonly property var mediaService: bar?.shell?.firstPartyServiceFor("omarchy.media")
|
||||
readonly property var activePlayer: mediaService ? mediaService.activePlayer : null
|
||||
readonly property var sourcePlayers: mediaService ? mediaService.sourcePlayers : []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user