plugin

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package plugin contains objects and functions to load and use javascript plugins in order to extend the functionalities of your projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	sync.Mutex
	// The basename of the plugin.
	Name string
	// The actual javascript code.
	Code string
	// The full path of the plugin.
	Path string
	// contains filtered or unexported fields
}

Plugin is an object representing a javascript file exporting functions and variables that your project can use to extend its functionalities.

func Load

func Load(path string, defines map[string]interface{}) (*Plugin, error)

Load loads and compiles a plugin given its path with the provided definitions.

func (*Plugin) Call

func (p *Plugin) Call(name string, args ...interface{}) (interface{}, error)

Call executes one of the declared callbacks of the plugin by its name.

func (*Plugin) Clone

func (p *Plugin) Clone() *Plugin

Clone returns a new instance identical to the plugin.

Jump to

Keyboard shortcuts

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