Function that will be executed before the property or class has been processed, that receive the instance and cursor value as argument.
Optional
opt: Partial<PrePostOptions>Optional configution.
The class or property decorator function.
In the following example, the @Pre
operator is used read the value
of the cursor and make a debug log to notify the position where the
type definition start to be read.
@Pre((_, cursor) => { console.log(`${_.constructor.name} : ${cursor.offset()}`) })
class Protocol {
@Pre((_, cursor) => { console.log(`${_.constructor.name} : ${cursor.offset()}`) })
@Relation(PrimitiveSymbol.u8)
foo: number
}
@Pre
decorator defines a function computed before reading or writing the value of the decorated property or class .It is typically used for pre-processing tasks such as debugging, to run operation on the Cursor instance at runtime.