| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | * '1.0.0', |
| 41 | 41 | * true |
| 42 | 42 | * ); |
| 43 | 43 | * wp_enqueue_script( 'home-assistant-commands' ); |
| 44 | - * } ); | |
| 44 | + * }, 5 ); // Before the shell harvests the payload at priority 10. | |
| 45 | 45 | * openstation_register_command_script( 'home-assistant-commands' ); |
| 46 | 46 | * ``` |
| 47 | 47 | * |
| 48 | 48 | * The script's JS side calls `wp.os.registerCommand( { … } )` as |
| @@ -259,8 +259,11 @@ | ||
| 259 | 259 | 'scriptBefore' => $payload['before'], |
| 260 | 260 | 'scriptAfter' => $payload['after'], |
| 261 | 261 | 'scriptL10n' => $payload['l10n'], |
| 262 | 262 | 'scriptTranslations' => $payload['translations'], |
| 263 | + // The handle's dependency closure, replayed before the bundle | |
| 264 | + // on its lazy load — see `openstation_resolve_script_dependencies()`. | |
| 265 | + 'scriptDeps' => openstation_resolve_script_dependencies( $handle ), | |
| 263 | 266 | ); |
| 264 | 267 | $seen[ $handle ] = true; |
| 265 | 268 | } |
| 266 | 269 | return $out; |
| @@ -304,8 +307,11 @@ | ||
| 304 | 307 | 'scriptBefore' => $payload['before'], |
| 305 | 308 | 'scriptAfter' => $payload['after'], |
| 306 | 309 | 'scriptL10n' => $payload['l10n'], |
| 307 | 310 | 'scriptTranslations' => $payload['translations'], |
| 311 | + // The handle's dependency closure, replayed before the bundle | |
| 312 | + // on its lazy load — see `openstation_resolve_script_dependencies()`. | |
| 313 | + 'scriptDeps' => openstation_resolve_script_dependencies( $handle ), | |
| 308 | 314 | ); |
| 309 | 315 | } |
| 310 | 316 | return $out; |
| 311 | 317 | } |