(opts ...ContextBootstrapOption)
| 342 | } |
| 343 | |
| 344 | func newContextBootstrapOptions(opts ...ContextBootstrapOption) ContextBootstrapOptions { |
| 345 | cfg := ContextBootstrapOptions{ |
| 346 | loadStdOS: true, |
| 347 | injectTimers: true, |
| 348 | } |
| 349 | for _, opt := range opts { |
| 350 | if opt != nil { |
| 351 | opt(&cfg) |
| 352 | } |
| 353 | } |
| 354 | // Timer bootstrap imports from "os", so keep std/os enabled when timers |
| 355 | // are requested even if options were applied in a conflicting order. |
| 356 | if cfg.injectTimers && !cfg.loadStdOS { |
| 357 | cfg.loadStdOS = true |
| 358 | } |
| 359 | return cfg |
| 360 | } |
| 361 | |
| 362 | const defaultTimerBootstrapCode = ` |
| 363 | import { setTimeout, clearTimeout } from "os"; |
no outgoing calls
no test coverage detected