util

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 1 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignIfNotNil

func AssignIfNotNil[T any](dest *T, src *T) *T

AssignIfNotNil ... src が nil でない場合に dest に代入する。代入前の値を含むpointerを返す

Types

type EventEmitter added in v1.6.0

type EventEmitter interface {
	// Add ... イベントリスナーを追加する。
	// 追加されたリスナーを解除する関数を返します
	Add(f func()) func()
	// AddOnce ... イベントリスナーを一度だけ実行するように追加する。
	// 追加されたリスナーを解除する関数を返します
	AddOnce(f func()) func()
	// Clear ... イベントリスナーを全て削除する
	Clear()
	// Emit ... イベントを発火する
	Emit()
}

func NewEventEmitter added in v1.6.0

func NewEventEmitter() EventEmitter

NewEventEmitter ... EventEmitter を生成する

type EventEmitterWithParam added in v1.6.0

type EventEmitterWithParam[T any] interface {
	// Add ... イベントリスナーを追加する。
	// 追加されたリスナーを解除する関数を返します
	Add(func(T)) func()
	// AddOnce ... イベントリスナーを一度だけ実行するように追加する。
	// 追加されたリスナーを解除する関数を返します
	AddOnce(func(T)) func()
	// Clear ... イベントリスナーを全て削除する
	Clear()
	// Emit ... イベントを発火する
	Emit(T)
}

func NewEventEmitterWithParam added in v1.6.0

func NewEventEmitterWithParam[T any]() EventEmitterWithParam[T]

NewEventEmitterWithParam ... パラメータありの EventEmitter を生成する

Jump to

Keyboard shortcuts

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