From 45f1d969484000c045eaca352092b9ba64af7521 Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Sat, 12 Jul 2025 20:24:55 +0800 Subject: reorder code --- main.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'main.mjs') diff --git a/main.mjs b/main.mjs index 4bc1ce5..a607769 100644 --- a/main.mjs +++ b/main.mjs @@ -995,25 +995,25 @@ class Application { return } - const handler = new BluetoothHandler(Device.airmxPro()) - const successForm = new SuccessForm('form-result-success') const failureForm = new FailureForm('form-result-failure') + + const handler = new BluetoothHandler(Device.airmxPro()) const communicationForm = new CommunicationForm('form-communication', handler) .succeedTo(successForm) .failTo(failureForm) .onPair((deviceId) => { successForm.deviceIdUsing(deviceId) }) + const pairingActivationForm = new PairingActivationForm('form-pairing-activation') .nextTo(communicationForm) + const wifiCredentialsForm = new WifiCredentialsForm('form-wifi-credentials') .nextTo(pairingActivationForm) .onSubmit((credentials) => { communicationForm.wifiCredentialsUsing(credentials) }) - const welcomeForm = new WelcomeForm('form-welcome') - .nextTo(wifiCredentialsForm) // If the pairing process fails, we will redirect the user to the Wi-Fi // credentials form so that they can retry with different credentials. @@ -1021,7 +1021,9 @@ class Application { // Now that everything is set up, it's time to show the user // the welcome screen. - welcomeForm.display() + new WelcomeForm('form-welcome') + .nextTo(wifiCredentialsForm) + .display() } } -- cgit v1.2.3