Type used to identify the basic types used with DataType.
Listener type. Defines the function signature that a listener is expected to have.
Type that represents a boolean.
Type that represents a number.
Type that represents a string value.
Type that represents no value.
Decorator for defining what contract a certain class implements.
@serviceContract(contractHere)
class ServiceImpl {
...
}
With Typescript the decorator can't validate the type, but it is recommended to implement the same type as the contract was defined with:
interface EchoService {
echo(message: string): Promise<string>;
}
const EchoService = new ServiceContract<EchoService>()
.defineMethod('echo', {
returnType: stringType,
parameters: [
{
name: 'message',
type: stringType
}
]
});
@serviceContract(EchoService)
class EchoServiceImpl implements EchoService {
async echo(message: string) {
return message;
}
}
decorator
Generated using TypeDoc
Service contracts to define what methods and events services support.
Contracts are used to define how a service acts when used over the network. They help define what methods and events are available and what types and parameters those support.
For easy of use this module re-exports
AsyncEvent
,AsyncSubscribable
andListener
from Atvik as those are used for events.