()
| 219 | |
| 220 | /** @return {Promise<boolean>} */ |
| 221 | export async function normalizePosition() { |
| 222 | const updates = aliveScripts.reduce((res, script, index) => { |
| 223 | const { props } = script; |
| 224 | const position = index + 1; |
| 225 | if (props.position !== position) { |
| 226 | props.position = position; |
| 227 | (res || (res = {}))[props.id] = script; |
| 228 | } |
| 229 | return res; |
| 230 | }, null); |
| 231 | maxScriptPosition = aliveScripts.length; |
| 232 | if (updates) { |
| 233 | await storage[S_SCRIPT].set(updates); |
| 234 | updateLastModified(); |
| 235 | } |
| 236 | return !!updates; |
| 237 | } |
| 238 | |
| 239 | /** @return {Promise<Boolean>} */ |
| 240 | export async function sortScripts() { |
no test coverage detected