// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: MIT export struct CrankData { magic-number: int, cranks: [string] } export global BLogicBAPI { in property initialized: false; in property color1: #6c839a; in property color2: #4b5c72; in property color3: #185151; in property color4: #464969; in property color5: #1b1143; in property color6: #203158; in-out property crank1: "1"; in-out property crank2: "2"; in-out property crank3: "3"; in-out property crank4: "5"; in-out property crank5: "7"; in-out property crank6: "11"; out property status; public function crank-it(crank-data:CrankData) { if (crank-data.magic-number == 42) { self.status = "The answer to life, the universe and everything"; } else { self.status = "Just a number"; } if (crank-data.cranks.length >= 6) { self.crank1 = crank-data.cranks[0]; self.crank2 = crank-data.cranks[1]; self.crank3 = crank-data.cranks[2]; self.crank4 = crank-data.cranks[3]; self.crank5 = crank-data.cranks[4]; self.crank6 = crank-data.cranks[5]; } } } export component BLogicB { private property api-initialized <=> BLogicBAPI.initialized; width: 600px; height: 240px; GridLayout { Row { Rectangle { background: BLogicBAPI.color1; Text { text <=> BLogicBAPI.crank1; color: white; font-size: 24px; horizontal-alignment: center; vertical-alignment: center; } } Rectangle { background: BLogicBAPI.color2; Text { text <=> BLogicBAPI.crank2; color: white; font-size: 24px; horizontal-alignment: center; vertical-alignment: center; } } } Row { Rectangle { background: BLogicBAPI.color3; Text { text <=> BLogicBAPI.crank3; color: white; font-size: 24px; horizontal-alignment: center; vertical-alignment: center; } } Rectangle { background: BLogicBAPI.color4; Text { text <=> BLogicBAPI.crank4; color: white; font-size: 24px; horizontal-alignment: center; vertical-alignment: center; } } } Row { Rectangle { background: BLogicBAPI.color5; Text { text <=> BLogicBAPI.crank5; color: white; font-size: 24px; horizontal-alignment: center; vertical-alignment: center; } } Rectangle { background: BLogicBAPI.color6; Text { text <=> BLogicBAPI.crank6; color: white; font-size: 24px; horizontal-alignment: center; vertical-alignment: center; } } } } changed api-initialized => { if (self.api-initialized) { debug("BLogicBAPI initialized"); } } }