MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / main

Function main

examples/context/src/sync-async.ts:67–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67export async function main() {
68 const ctx = new Context('request');
69 // Bind `GREETER` to a class from which the value is instantiated
70 ctx.bind(GREETER).toClass(Greeter);
71
72 // Now try to invoke a greeter with synchronous resolution of the current user
73 await greetWithSyncUser(ctx);
74
75 // Then try to invoke a greeter with asynchronous resolution of the current user
76 await greetWithAsyncUser(ctx);
77}
78
79if (require.main === module) {
80 main().catch(err => {

Callers 1

sync-async.tsFile · 0.70

Calls 4

bindMethod · 0.95
greetWithSyncUserFunction · 0.85
greetWithAsyncUserFunction · 0.85
toClassMethod · 0.80

Tested by

no test coverage detected