Calls the callback with the result. For testing requests with Callback.
(r *Request)
| 520 | |
| 521 | // Calls the callback with the result. For testing requests with Callback. |
| 522 | func SquareCB(r *Request) (interface{}, error) { |
| 523 | args := r.Args.MustSliceOfLength(2) |
| 524 | a := args[0].MustFloat64() |
| 525 | cb := args[1].MustFunction() |
| 526 | |
| 527 | result := a * a |
| 528 | |
| 529 | r.LocalKite.Log.Info("Kite call, sending result '%f' back\n", result) |
| 530 | |
| 531 | // Send the result. |
| 532 | err := cb.Call(result) |
| 533 | if err != nil { |
| 534 | return nil, err |
| 535 | } |
| 536 | |
| 537 | return nil, nil |
| 538 | } |
| 539 | |
| 540 | func newXhrKite(name, version string) *Kite { |
| 541 | k := New(name, version) |
nothing calls this directly
no test coverage detected