diff options
Diffstat (limited to 'config/webpack/utils/script-runtime.js')
| -rw-r--r-- | config/webpack/utils/script-runtime.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/config/webpack/utils/script-runtime.js b/config/webpack/utils/script-runtime.js index a7c02f7..2745d54 100644 --- a/config/webpack/utils/script-runtime.js +++ b/config/webpack/utils/script-runtime.js @@ -1,4 +1,15 @@ -export const getScriptRuntimeFromType = scriptType => { +/** + * Maps a human-readable script type to a Chrome content-script + * `run_at` value. + * + * - `"before"`, `"injected-after"`, `"injected-before"` → `document_start` + * - `"rendered"` → `document_end` + * - `"loaded"` (or unknown) → `document_idle` + * + * @param {string} scriptType - The script type from scripts.json. + * @returns {string} The corresponding `run_at` value. + */ +export function getScriptRuntimeFromType(scriptType) { switch (scriptType) { case "before": case "injected-after": |
