jsii

package module
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 13 Imported by: 594

README

jsii

The jsii runtime library for Go

This is the jsii runtime for go. This repository is used only for publishing the go module. The source code is managed in the main JSII repository. Refer to the go-runtime readme there for details on building and testing the module.

⚖ License

jsii is distributed under the Apache License, Version 2.0.

See LICENSE and NOTICE for more information.

Documentation

Overview

Package jsii provides the APIs used by code generated by the jsii-pacmak tool to interact with the @jsii/kernel process. It is not intended for users to directly interact with, and doing so could result in incorrect behavior.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close finalizes the runtime process, signalling the end of the execution to the jsii kernel process, and waiting for graceful termination. The best practice is to defer call thins at the beginning of the "main" function.

If a jsii client is used *after* Close was called, a new jsii kernel process will be initialized, and Close should be called again to correctly finalize that, too. This behavior is intended for use in unit/integration tests.

func Create

func Create(fqn FQN, args []interface{}, interfaces []FQN, overrides []Override, ret interface{})

Create will construct a new JSII object within the kernel runtime. This is called by jsii object constructors.

func Get

func Get(obj interface{}, property string, ret interface{})

Get reads a property value on a given jsii class instance. The response should be decoded into the expected type of the property being read.

func Invoke

func Invoke(obj interface{}, method string, args []interface{}, hasReturn bool, ret interface{})

Invoke will call a method on a jsii class instance. The response should be decoded into the expected return type for the method being called.

func Load

func Load(name string, version string, tarball []byte)

Load ensures a npm package is loaded in the jsii kernel.

func RegisterClass added in v1.22.0

func RegisterClass(fqn FQN, class reflect.Type, iface reflect.Type)

RegisterClass associates a class fully qualified name to the specified struct type, and class interface. Panics if class is not a struct, iface is not an interface, or if the provided fqn was already used to register a different type.

func RegisterEnum added in v1.22.0

func RegisterEnum(fqn FQN, enum reflect.Type, members map[string]interface{})

RegisterEnum associates an enum's fully qualified name to the specified enum type, and members. Panics if enum is not a reflect.String type, any value in the provided members map is of a type ofther than enum, or if the provided fqn was already used to register a different type.

func RegisterInterface added in v1.22.0

func RegisterInterface(fqn FQN, iface reflect.Type, proxy reflect.Type)

RegisterInterface associates an interface's fully qualified name to the specified interface type, and proxy struct. Panics if iface is not an interface, proxy is not a struct, or if the provided fqn was already used to register a different type.

func RegisterStruct added in v1.22.0

func RegisterStruct(fqn FQN, strct reflect.Type, iface reflect.Type)

RegisterStruct associates a struct's fully qualified name to the specified struct type, and struct interface. Panics if strct is not a struct, iface is not an interface, or if the provided fqn was already used to register a different type.

func Set

func Set(obj interface{}, property string, value interface{})

Set writes a property on a given jsii class instance. The value should match the type of the property being written, or the jsii kernel will crash.

func StaticGet

func StaticGet(fqn FQN, property string, ret interface{})

StaticGet reads a static property value on a given jsii class. The response should be decoded into the expected type of the property being read.

func StaticInvoke added in v1.22.0

func StaticInvoke(fqn FQN, method string, args []interface{}, hasReturn bool, ret interface{})

StaticInvoke will call a static method on a given jsii class. The response should be decoded into the expected return type for the method being called.

func StaticSet

func StaticSet(fqn FQN, property string, value interface{})

StaticSet writes a static property on a given jsii class. The value should match the type of the property being written, or the jsii kernel will crash.

Types

type FQN

type FQN string

FQN represents a fully-qualified type name in the jsii type system.

type MethodOverride

type MethodOverride struct {
	Method *string `json:"method"`
	Cookie *string `json:"cookie"`
	// contains filtered or unexported fields
}

MethodOverride is used to register a "go-native" implementation to be substituted to the default javascript implementation on the created object.

type Override

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

Override is a public interface implementing a private method `isOverride` implemented by the private custom type `override`. This is embedded by MethodOverride and PropertyOverride to simulate the union type of Override = MethodOverride | PropertyOverride.

type PropertyOverride

type PropertyOverride struct {
	Property *string `json:"property"`
	Cookie   *string `json:"cookie"`
	// contains filtered or unexported fields
}

PropertyOverride is used to register a "go-native" implementation to be substituted to the default javascript implementation on the created object.

Jump to

Keyboard shortcuts

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