console

package
v0.0.0-...-e43970d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectMultipleTo

func InjectMultipleTo(ctx *v8go.Context, consoles ...Console) error

InjectMultipleTo injects one or more console methods to a global object of a context.

Implementing the Console interface will not work in this case.

func InjectTo

func InjectTo(ctx *v8go.Context, opt ...Option) error

InjectTo injects basic console.log support.

Warning: This method overwrites the previous console object. To add more than one console.foo method, use InjectMultipleTo.

Types

type Console

type Console interface {
	GetLogFunctionCallback() v8go.FunctionCallback
}

Console is a single console *method*.

This can hardly be called a console, the name is kept for backwords compatability.

func NewConsole

func NewConsole(opt ...Option) Console

NewConsole creates a new console method.

InjectTo() calls this under the hood, so its best to use that instead if you only want console.log to be available, otherwise use InjectMultipleTo().

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithMethodName

func WithMethodName(methodName string) Option

WithMethodName sets the method name for this console method. Default "log".

func WithOutput

func WithOutput(output io.Writer) Option

WithOutput sets the output for this console method. Default os.Stdout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL