update README

This commit is contained in:
Star 2024-10-11 10:27:30 +08:00
parent 7f89e9bfdb
commit e7bee88ac8

View File

@ -1,61 +1,56 @@
# util for GoJS
# console for GoJS
## usage
```go
import (
"apigo.cc/gojs"
_ "apigo.cc/gojs/util"
"apigo.cc/gojs"
_ "apigo.cc/gojs/console"
)
func main() {
r, err := gojs.Run(`
import util from 'apigo.cc/gojs/util'
r, err := gojs.Run(`
import console from 'apigo.cc/gojs/console'
function main(args){
return util.sha512('hello 123')
console.info('hello 123')
}
`, "test.js")
`, "test.js")
fmt.Println(r, err, r == "27d0d415a3b14bdeb5ab5b2298ed3aed272361688927250eaef201603b84dd8bebb57cae089d6b5f1e9aee122a67917ccdf8a9ba5e499c64b35e133c7f6b007a")
fmt.Println(r, err)
}
```
## module.exports
```ts
function json(data:any): string {return ''}
function jsonP(data:any): string {return ''}
function unJson(data:string): any {return null}
function yaml(data:any): string {return ''}
function unYaml(data:string): any {return null}
function load(filename:string): any {return null}
function save(filename:string, data:any) {}
function base64(data:any): string {return ''}
function unBase64(data:string): any {return null}
function urlBase64(data:any): string {return ''}
function unUrlBase64(data:string): any {return null}
function hex(data:any): string {return ''}
function unHex(data:string): any {return null}
function aes(data:any, key:string, iv:string): string {return ''}
function unAes(data:string, key:string, iv:string): any {return null}
function gzip(data:any): string {return ''}
function gunzip(data:string): any {return null}
function id(): string {return ''}
function uniqueId(): string {return ''}
function token(size:number): string {return ''}
function md5(data:any): string {return ''}
function sha1(data:any): string {return ''}
function sha256(data:any): string {return ''}
function sha512(data:any): string {return ''}
function tpl(text:string, data:any, functions?:Object): string {return ''}
function sleep(ms:number): void {}
function setTimeout(callback:()=>void, ms?:number, ...args:any): void {}
function shell(cmd:string, ...args:string[]): string[] {return []}
function toDatetime(timestamp:number): string {return ''}
function fromDatetime(datetimeStr:string): number {return 0}
function toDate(timestamp:number): string {return ''}
function fromDate(dateStr:string): number {return 0}
function print(...data: any[]): void {}
function println(...data: any[]): void {}
function log(...data: any[]): void {}
function debug(...data: any[]): void {}
function info(...data: any[]): void {}
function warn(...data: any[]): void {}
function error(...data: any[]): void {}
function input(...data: any[]): string {return ''}
function black(...data: any[]): string {return ''}
function red(...data: any[]): string {return ''}
function green(...data: any[]): string {return ''}
function yellow(...data: any[]): string {return ''}
function blue(...data: any[]): string {return ''}
function magenta(...data: any[]): string {return ''}
function cyan(...data: any[]): string {return ''}
function white(...data: any[]): string {return ''}
function dim(...data: any[]): string {return ''}
function italic(...data: any[]): string {return ''}
function bBlack(...data: any[]): string {return ''}
function bRed(...data: any[]): string {return ''}
function bGreen(...data: any[]): string {return ''}
function bYellow(...data: any[]): string {return ''}
function bBlue(...data: any[]): string {return ''}
function bMagenta(...data: any[]): string {return ''}
function bCyan(...data: any[]): string {return ''}
function bWhite(...data: any[]): string {return ''}
```
## full api see [util.ts](http://apigo.cc/gojs/util/util.ts)
## full api see [console.ts](http://apigo.cc/gojs/console/console.ts)