Type Alias FarClassOptions<C, F>

FarClassOptions<C, F>: {
    finish?: ((context: C) => void);
    receiveAmplifier?: ReceivePower<Amplify<F>>;
    receiveInstanceTester?: ReceivePower<IsInstance>;
    stateShape?: StateShape;
}

Currently, this one options type is used both for regular exo classes as well as exo class kits. However, we may split these into distinct types in the future, as not all options make sense for both uses.

Type Parameters

  • C
  • F = any

Type declaration

  • Optionalfinish?: ((context: C) => void)

    If provided, the finish function is called after the instance has been initialized and registered, but before it is returned. Try to avoid using finish if you can, as we think we'd like to deprecate and retire it. OTOH, if you encounter a compelling need, please let us know so we can revise our plans.

      • (context): void
      • Parameters

        • context: C

        Returns void

  • OptionalreceiveAmplifier?: ReceivePower<Amplify<F>>

    If a receiveAmplifier function is provided, it will be called during definition of the exo class kit with an Amplify function. If called during the definition of a normal exo or exo class, it will throw, since only exo kits can be amplified. An Amplify function is a function that takes a facet instance of this class kit as an argument, in which case it will return the facets record, giving access to all the facet instances of the same cohort.

  • OptionalreceiveInstanceTester?: ReceivePower<IsInstance>

    If a receiveInstanceTester function is provided, it will be called during the definition of the exo class or exo class kit with an IsInstance function. The first argument of IsInstance is the value to be tested. When it may be a facet instance of an exo class kit, the optional second argument, if provided, is a facetName. In that case, the function tests only if the first argument is an instance of that facet of the associated exo class kit.

  • OptionalstateShape?: StateShape

    If provided, it must be a RecordPattern, i.e., a CopyRecord which is also a Pattern. It thus has an exactly defined set of property names and a Pattern as the value of each property. This is supposed to be an invariant on the properties of an instance state record. TODO Though note that only the virtual and durable exos currently enforce the stateShape invariant. The heap exos defined in this package currently ignore stateShape, but will enforce this in the future.