d2/d2js/d2wasm/types.go

29 lines
549 B
Go
Raw Normal View History

2024-12-21 01:08:19 +00:00
//go:build js && wasm
package d2wasm
import "oss.terrastruct.com/d2/d2ast"
type WASMResponse struct {
Data interface{} `json:"data,omitempty"`
Error *WASMError `json:"error,omitempty"`
}
type WASMError struct {
Message string `json:"message"`
Code int `json:"code"`
}
func (e *WASMError) Error() string {
return e.Message
}
type RefRangesResponse struct {
Ranges []d2ast.Range `json:"ranges"`
ImportRanges []d2ast.Range `json:"importRanges"`
}
type BoardPositionResponse struct {
BoardPath []string `json:"boardPath"`
}