71 lines
1.3 KiB
Markdown
71 lines
1.3 KiB
Markdown
# Readme draft
|
|
|
|
1. write code
|
|
2. annotate it (see below)
|
|
3. launch `kitcom -src path/to/source.A -dest path/to/generated/file.B`
|
|
4. Use generated file for IPC
|
|
|
|
## Typescript:
|
|
|
|
Currently only whole classes are supported.
|
|
|
|
### Annotate:
|
|
|
|
```typescript
|
|
/**
|
|
* @kittenipc api
|
|
*/
|
|
class ClassName {}
|
|
```
|
|
|
|
### Usage:
|
|
|
|
```typescript
|
|
const localApi = new LocalAPI(); // LocalAPI is written by hand
|
|
const ipc = new ChildIPC(localApi);
|
|
const goApi = new RemoteAPI(ipc); // RemoteAPI is generated by kitcom
|
|
await ipc.start();
|
|
// work
|
|
await ipc.wait();
|
|
```
|
|
|
|
## Golang:
|
|
|
|
Currently only whole structs are supported
|
|
|
|
### Annotate
|
|
|
|
```go
|
|
// kittenipc:api
|
|
type StructName struct {
|
|
}
|
|
```
|
|
|
|
### Usage:
|
|
|
|
```go
|
|
localApi := LocalAPI{} // LocalAPI is written by hand
|
|
cmd := exec.Command(fmt.Sprintf("node %s", "path to compiled js"))
|
|
ipc, err := kittenipc.NewParent(cmd, &localApi)
|
|
remoteApi := RemoteAPI{Ipc: ipc} // RemoteAPI is generated by kitcom
|
|
if err != nil {
|
|
log.Panic(err)
|
|
}
|
|
if err := ipc.Start(); err != nil {
|
|
log.Panic(err)
|
|
}
|
|
// work
|
|
if err := kit.Wait(); err != nil {
|
|
log.Panic(err)
|
|
}
|
|
```
|
|
|
|
LocalAPI on one side is RemoteAPI on the other side
|
|
|
|
## C++, Rust, Python:
|
|
|
|
To be done
|
|
|
|
# Library status
|
|
Work in progress. No tests, no docs, code is not finished! Not everything is working yet. Code is partly crap.
|