node.mx raw

   1  //:build !wasm
   2  
   3  package node
   4  
   5  // Node jsbridge - stdin/stdout/stderr line-oriented IO for Node.js CLI targets.
   6  // Runtime implementation lives in moxiejs jsruntime/node.mjs.
   7  
   8  // OnLine registers a line-handler for stdin. Called per line (no trailing newline).
   9  // If stdin closes, the runtime closes any channel the handler sends to.
  10  func OnLine(fn func(string)) { panic("jsbridge") }
  11  
  12  // OnClose registers a handler called once when stdin hits EOF.
  13  func OnClose(fn func()) { panic("jsbridge") }
  14  
  15  // WriteLine writes a line to stdout (newline appended). Flushed immediately.
  16  func WriteLine(s string) { panic("jsbridge") }
  17  
  18  // WriteErr writes a line to stderr (newline appended).
  19  func WriteErr(s string) { panic("jsbridge") }
  20  
  21  // Exit terminates the process with the given code.
  22  func Exit(code int32) { panic("jsbridge") }
  23  
  24  // NowSeconds returns current time as Unix seconds (Node wall clock).
  25  func NowSeconds() (n int64) { panic("jsbridge") }
  26