MCPcopy
hub / github.com/duke-git/lancet / ExampleThen

Function ExampleThen

promise/promise_example_test.go:27–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27func ExampleThen() {
28 p1 := New(func(resolve func(string), reject func(error)) {
29 resolve("hello ")
30 })
31
32 p2 := Then(p1, func(s string) string {
33 return s + "world"
34 })
35
36 result, err := p2.Await()
37 if err != nil {
38 return
39 }
40
41 fmt.Println(result)
42
43 // Output:
44 // hello world
45}
46
47func ExamplePromise_Then() {
48 p1 := New(func(resolve func(string), reject func(error)) {

Callers

nothing calls this directly

Calls 3

ThenFunction · 0.85
AwaitMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…