emit
Algorand TypeScript / index / emit
Call Signature
Section titled “Call Signature”emit<
TEvent>(event):void
Defined in: arc-28.ts:22
Emit an arc28 event log using either an ARC4Struct type or a named object type. Object types must have an ARC4 equivalent type.
Anonymous types cannot be used as the type name is used to determine the event prefix
Type Parameters
Section titled “Type Parameters”TEvent
Section titled “TEvent”TEvent extends Record<string, any>
Parameters
Section titled “Parameters”TEvent
An ARC4Struct instance, or a plain object with a named type
Returns
Section titled “Returns”void
Examples
Section titled “Examples”class Demo extends Struct<{ a: Uint64 }> {}emit(new Demo({ a: new Uint64(123) }));type Demo = { a: uint64 };emit<Demo>({ a: 123 });// orconst d: Demo = { a: 123 };emit(d);Call Signature
Section titled “Call Signature”emit<
TProps>(eventName, …eventProps):void
Defined in: arc-28.ts:36
Emit an arc28 event log using an explicit name and inferred property/field types. Property types must be ARC4 or have an ARC4 equivalent type.
Type Parameters
Section titled “Type Parameters”TProps
Section titled “TProps”TProps extends any[]
Parameters
Section titled “Parameters”eventName
Section titled “eventName”string
The name of the event (must be a compile time constant)
eventProps
Section titled “eventProps”…TProps
A set of event properties (order is significant)
Returns
Section titled “Returns”void
Examples
Section titled “Examples”emit('Demo', new Uint64(123));const a: uint64 = 123;emit('Demo', a);