From 9ffaaa219e11dbb6c5e7686a79c122384d644114 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Mon, 23 Mar 2020 12:22:37 +0500 Subject: [PATCH] Ability to set handlers. --- metas/generic.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/metas/generic.go b/metas/generic.go index b03f02e..ec17baa 100644 --- a/metas/generic.go +++ b/metas/generic.go @@ -56,6 +56,11 @@ func (g *Generic) InitializeGeneric() { g.initializeInnerItems() } +// SetHandler sets handler function for specific event. +func (g *Generic) SetHandler(event string, handler func(e *js.Object)) { + g.Object.Set(event, handler) +} + // SetTextContent sets text content for passed object. Note that not // all HTML elements able to display it. func (g *Generic) SetTextContent(text string) {