callback_native.mx raw

   1  //:build !wasm
   2  
   3  package callback
   4  
   5  // The callback registry exists only on wasm: its whole job is to hand a JS host
   6  // an integer id for a Moxie function value and let the host call back through
   7  // the Dispatch* wasm exports. A native build gets these stubs so that a package
   8  // which imports the web framework still COMPILES natively - calling one is a
   9  // bug, and it says so.
  10  //
  11  // This mirrors the stub/wasm split every web package uses (see web/dom: stub in
  12  // dom.mx, body in dom_wasm.mx).
  13  
  14  func Register0(fn func()) (n int32)                              { panic(nativeStub) }
  15  func Register0Once(fn func()) (n int32)                          { panic(nativeStub) }
  16  func RegisterS(fn func(string)) (n int32)                        { panic(nativeStub) }
  17  func RegisterSOnce(fn func(string)) (n int32)                    { panic(nativeStub) }
  18  func RegisterB(fn func(bool)) (n int32)                          { panic(nativeStub) }
  19  func RegisterBOnce(fn func(bool)) (n int32)                      { panic(nativeStub) }
  20  func RegisterI(fn func(int32)) (n int32)                         { panic(nativeStub) }
  21  func RegisterIOnce(fn func(int32)) (n int32)                     { panic(nativeStub) }
  22  func RegisterIS(fn func(int32, string)) (n int32)                { panic(nativeStub) }
  23  func RegisterISOnce(fn func(int32, string)) (n int32)            { panic(nativeStub) }
  24  func RegisterIIS(fn func(int32, int32, string)) (n int32)        { panic(nativeStub) }
  25  func RegisterIISOnce(fn func(int32, int32, string)) (n int32)    { panic(nativeStub) }
  26  func RegisterSS(fn func(string, string)) (n int32)               { panic(nativeStub) }
  27  func RegisterSSOnce(fn func(string, string)) (n int32)           { panic(nativeStub) }
  28  func Register6I(fn func(int32, int32, int32, int32, int32, int32)) (n int32) {
  29  	panic(nativeStub)
  30  }
  31  func Register6IOnce(fn func(int32, int32, int32, int32, int32, int32)) (n int32) {
  32  	panic(nativeStub)
  33  }
  34  func RegisterII(fn func(int32, int32)) (n int32)                  { panic(nativeStub) }
  35  func RegisterIIOnce(fn func(int32, int32)) (n int32)              { panic(nativeStub) }
  36  func RegisterIII(fn func(int32, int32, int32)) (n int32)          { panic(nativeStub) }
  37  func RegisterIIIOnce(fn func(int32, int32, int32)) (n int32)      { panic(nativeStub) }
  38  func RegisterBytes(fn func([]byte)) (n int32)                     { panic(nativeStub) }
  39  func RegisterBytesOnce(fn func([]byte)) (n int32)                 { panic(nativeStub) }
  40  func Release(id int32)                                            { panic(nativeStub) }
  41  
  42  const nativeStub = "callback: the browser callback registry is wasm-only"
  43