MCPcopy Create free account
hub / github.com/buke/quickjs-go / newContextBootstrapOptions

Function newContextBootstrapOptions

runtime.go:344–360  ·  view source on GitHub ↗
(opts ...ContextBootstrapOption)

Source from the content-addressed store, hash-verified

342}
343
344func 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
362const defaultTimerBootstrapCode = `
363import { setTimeout, clearTimeout } from "os";

Callers 1

NewContextWithOptionsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected