Skip to content

Commit

Permalink
Fixing Vega.Compile
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Jan 16, 2024
1 parent 754a459 commit 94d408a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vegagoja.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ import (
"github.com/dop251/goja_nodejs/require"
)

// renderFunc is the signature for the render function.
type renderFunc func(logger func([]string), spec string, data interface{}, cb func(string)) string
// loggerFunc is the signature for the log func.
type loggerFunc func([]string)

// renderFunc is the signature for the render func.
type renderFunc func(logger loggerFunc, spec string, data interface{}, cb func(string)) string

// Vega handles rendering Vega visualizations as SVGs.
//
Expand All @@ -32,7 +35,7 @@ type Vega struct {
liteVer func() string
vegaRender renderFunc
liteRender renderFunc
liteCompile func(string) (string, error)
liteCompile func(loggerFunc, string) (string, error)
logger func(...interface{})
sources fs.FS
once sync.Once
Expand Down Expand Up @@ -116,7 +119,7 @@ func (vm *Vega) Compile(spec string) (string, error) {
if err := vm.init(); err != nil {
return "", err
}
return vm.liteCompile(spec)
return vm.liteCompile(vm.log, spec)
}

// Render renders the spec with the specified data.
Expand Down

0 comments on commit 94d408a

Please sign in to comment.