MCPcopy Create free account
hub / github.com/buke/quickjs-go / Accessor

Method Accessor

class.go:194–202  ·  view source on GitHub ↗

Accessor adds a read-write accessor to the class instance - unchanged Pass nil for getter to create write-only accessor Pass nil for setter to create read-only accessor

(name string, getter ClassGetterFunc, setter ClassSetterFunc)

Source from the content-addressed store, hash-verified

192// Pass nil for getter to create write-only accessor
193// Pass nil for setter to create read-only accessor
194func (cb *ClassBuilder) Accessor(name string, getter ClassGetterFunc, setter ClassSetterFunc) *ClassBuilder {
195 cb.accessors = append(cb.accessors, AccessorEntry{
196 Name: name,
197 Getter: getter,
198 Setter: setter,
199 Static: false,
200 })
201 return cb
202}
203
204// StaticAccessor adds a read-write static accessor to the class constructor - unchanged
205// Pass nil for getter to create write-only accessor

Calls

no outgoing calls