ElementEvent

command
v0.0.0-...-f6e44e9 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

注册元素事件

炫彩的全部事件都已经在各种类里定义好了,有两种形式,分别以两种格式开头: `AddEvent` 或 `Event` ,一般使用 `AddEvent` 类型的函数即可。

区别是:由于使用的是 `syscall.NewCallback` 创建的事件回调函数,该方法限制只能创建 2000 个左右的回调函数,超过就会 panic。当使用 `Event` 类型的函数来注册事件且回调函数是匿名函数时,每次都会创建 1 个新的回调函数,如果不加以控制,就可能会超过 2000 个。而 `AddEvent` 类型的函数会复用创建好的回调函数,可以任意使用匿名函数作为事件回调函数,无需担心超过 2000 个的限制。

Jump to

Keyboard shortcuts

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