program.go 413 B

1234567891011121314151617181920212223
  1. package mjs
  2. import (
  3. "github.com/dop251/goja"
  4. )
  5. func initProgram(name, content string, modified int64, engine *Mjs) *jsProgram {
  6. prog, err := goja.Compile(name, content, true)
  7. return &jsProgram{
  8. name: name,
  9. prog: prog,
  10. modified: modified,
  11. compileErr: err,
  12. }
  13. }
  14. type jsProgram struct {
  15. name string
  16. prog *goja.Program
  17. modified int64
  18. engine *Mjs
  19. compileErr error
  20. }