Skip to content

Package gopherjslib provides helpers for in-process GopherJS compilation.

License

Notifications You must be signed in to change notification settings

shurcooL-deprecated/gopherjslib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gopherjslib

Go Reference

Package gopherjslib provides helpers for in-process GopherJS compilation.

All of them take the optional *Options argument. It can be used to set a different GOROOT or GOPATH directory or to enable minification.

Example compiling Go code:

import "github.com/shurcooL/gopherjslib"

...

code := strings.NewReader(`
	package main
	import "github.com/gopherjs/gopherjs/js"
	func main() { println(js.Global.Get("window")) }
`)

var out bytes.Buffer

err := gopherjslib.Build(code, &out, nil) // <- default options

Example compiling multiple files:

var out bytes.Buffer

builder := gopherjslib.NewBuilder(&out, nil)

fileA := strings.NewReader(`
	package main
	import "github.com/gopherjs/gopherjs/js"
	func a() { println(js.Global.Get("window")) }
`)

builder.Add("a.go", fileA)

// And so on for each file, then:

err = builder.Build()

Deprecated: The intermediate API layer implemented by this package has proven to be unhelpful and is now unmaintained. Use packages github.com/gopherjs/gopherjs/build and github.com/gopherjs/gopherjs/compiler or command github.com/gopherjs/gopherjs directly instead.

Installation

go get github.com/shurcooL/gopherjslib

License

About

Package gopherjslib provides helpers for in-process GopherJS compilation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages