github.com/primecitizens/pcz/std@v0.2.1/ffi/js/example_test.go (about)

     1  package js_test
     2  
     3  import "github.com/primecitizens/pcz/std/ffi/js"
     4  
     5  type MyType struct {
     6  }
     7  
     8  func (T MyType) PromiseExecute(this js.Any) (value, reason js.Ref, fulfilled bool) {
     9  	return
    10  }
    11  
    12  func ExampleGoPromise() {
    13  	x := js.Executor[MyType]{}
    14  	js.Promise[js.String]{}.FromRef(
    15  		x.Reset(MyType{}, MyType.PromiseExecute),
    16  	)
    17  }