Debian Codegraph @

js/init.go

raw symbols SCIP
1 package js
2
3 import (
4 "github.com/evilsocket/islazy/log"
5 "github.com/evilsocket/islazy/plugin"
6 "github.com/robertkrimen/otto"
7 )
8
9 var NullValue = otto.Value{}
10
11 func ReportError(format string, args ...interface{}) otto.Value {
12 log.Error(format, args...)
13 return NullValue
14 }
15
16 func init() {
17 // TODO: refactor this in packages
18
19 plugin.Defines["readDir"] = readDir
20 plugin.Defines["readFile"] = readFile
21 plugin.Defines["writeFile"] = writeFile
22
23 plugin.Defines["log"] = flog
24 plugin.Defines["log_debug"] = log_debug
25 plugin.Defines["log_info"] = log_info
26 plugin.Defines["log_warn"] = log_warn
27 plugin.Defines["log_error"] = log_error
28 plugin.Defines["log_fatal"] = log_fatal
29
30 plugin.Defines["btoa"] = btoa
31 plugin.Defines["atob"] = atob
32 plugin.Defines["gzipCompress"] = gzipCompress
33 plugin.Defines["gzipDecompress"] = gzipDecompress
34
35 plugin.Defines["httpRequest"] = httpRequest
36 plugin.Defines["http"] = httpPackage{}
37
38 plugin.Defines["random"] = randomPackage{}
39 }