Best I could come up with
    
    
    import jsffi
    
    type
      Client = object
        connect {.exportc.}: proc (server, username, password: cstring)
    
    proc connect*(client: var Client, server, username, password: cstring) =
      discard
    
    proc newClient*(): Client {.exportc.} =
      result = Client{}
      result.connect = proc (server, username, password: cstring) =
        connect(self, server, username, password)
    
    
    Run

Are you sure it's worth it? I don't think JS output is supposed to be used in 
actual JS

Reply via email to