Method adds an instance method to the class - unchanged Instance methods are called on object instances
(name string, fn ClassMethodFunc)
| 167 | // Method adds an instance method to the class - unchanged |
| 168 | // Instance methods are called on object instances |
| 169 | func (cb *ClassBuilder) Method(name string, fn ClassMethodFunc) *ClassBuilder { |
| 170 | cb.methods = append(cb.methods, MethodEntry{ |
| 171 | Name: name, |
| 172 | Func: fn, |
| 173 | Static: false, |
| 174 | Length: 0, |
| 175 | }) |
| 176 | return cb |
| 177 | } |
| 178 | |
| 179 | // StaticMethod adds a static method to the class - unchanged |
| 180 | // Static methods are called on the constructor function itself |
no outgoing calls