MCPcopy Index your code
hub / github.com/koding/kite / SquareCB

Function SquareCB

kite_test.go:522–538  ·  view source on GitHub ↗

Calls the callback with the result. For testing requests with Callback.

(r *Request)

Source from the content-addressed store, hash-verified

520
521// Calls the callback with the result. For testing requests with Callback.
522func 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
540func newXhrKite(name, version string) *Kite {
541 k := New(name, version)

Callers

nothing calls this directly

Calls 5

MustSliceOfLengthMethod · 0.80
MustFloat64Method · 0.80
MustFunctionMethod · 0.80
InfoMethod · 0.80
CallMethod · 0.65

Tested by

no test coverage detected