ScriptLoading final class
Minn\Runtime\ScriptLoading · public/minn/src/Minn/Runtime/ScriptLoading.php · 82 lines
How a script may load, as the reference decides it (probe dependencies-classes). A script keeps its own strategy (defer or async) unless it has inline code after it, which makes it blocking, or an enqueued dependent (however deep, through dependents that are themselves enqueued) loads more strictly: blocking before defer before async. Its fetch priority rises to the highest among those dependents: low, then auto, then high. A delayed script that cannot be delayed (inline code after it) waits for the footer when nothing enqueued depends on it. The values a script may be given are checked here too.
Constants and properties
| private | STRATEGIES = array ( '' => 0, 'defer' => 1, 'async' => 2, ) | |
| private | PRIORITIES = array ( 'low' => 0, 'auto' => 1, 'high' => 2, ) | |
| private | readonly Minn\Runtime\Assets $assets | Promoted from the constructor. |
Public
| new | __construct(Minn\Runtime\Assets $assets)# | ||||
| static | refusal(string $handle, string $key, mixed $value): ?array# | Why a strategy or fetch priority value is refused, as the notice the reference gives; null when the value is fine (empty is fine). @return array{0: string, 1: string}|null the message and the version | |||
| method | strategy(string $handle, array $checked = array ( )): string# | The strategy a script loads with: 'defer', 'async', or '' for blocking. @param array<string, true> $checked
| |||
| method | heldForFooter(string $handle): bool# | Whether the head pass holds a script for the footer: one that asked to be delayed but has inline code after it, with nothing enqueued that depends on it. | |||
| method | priority(string $handle): array# | A script's own fetch priority and the one it loads with. @return array{0: string, 1: string} @return array{0: string, 1: string} |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.