Documentation ¶
Index ¶
- func CallOnPanic(reject func(interface{}))
- func CallWithErrorCallback(jsObject *js.Object, fn string, args ...interface{}) error
- func CallWithResultCallback(jsObject *js.Object, fn string, args ...interface{}) (*js.Object, error)
- func CatchPanic(returnedError *error, failureMessage string)
- func ForEach(object *js.Object, iterator func(key string, value *js.Object))
- func HasKey(object *js.Object, key string) bool
- func IsArray(object *js.Object) bool
- func IsFunction(object *js.Object) bool
- func Keys(object *js.Object) []string
- func NewError(message string) *js.Object
- func NewISODate() string
- func NewObject() *js.Object
- func NewPromise(function func(resolve func(interface{}), reject func(interface{}))) *js.Object
- func Parse(bytes []byte) (_ map[string]interface{}, returnedError error)
- func Promisify(function interface{}) func(args ...interface{}) *js.Object
- func Reject(value interface{}) *js.Object
- func Require(module string) *js.Object
- func Resolve(value interface{}) *js.Object
- func Stringify(data map[string]interface{}) (_ []byte, returnedError error)
- func Throw(object *js.Object)
- func ThrowOnError(err error)
- func ToGoError(jsError *js.Error) error
- func ToMap(object *js.Object) map[string]interface{}
- func ToSlice(array *js.Object) []interface{}
- func ToString(object *js.Object) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallOnPanic ¶
func CallOnPanic(reject func(interface{}))
CallOnPanic calls the supplied function when a panic is recovered. This should be called in a defer.
func CallWithErrorCallback ¶
CallWithErrorCallback calls a function in the supplied JS object with the supplied arguments, automatically attaching a callback to the end of the argument list that accepts an error.
func CallWithResultCallback ¶
func CallWithResultCallback(jsObject *js.Object, fn string, args ...interface{}) (*js.Object, error)
CallWithResultCallback calls a function in the provided JS object, automatically attaching a callback parameter to the end of the argument list. Returns when the JS callback is called with the appropriate value or error.
func CatchPanic ¶
CatchPanic catches a panic and puts the error into the supplied error. This should be called in a defer.
func IsFunction ¶
IsFunction determines if the supplied javascript object is a function.
func NewISODate ¶
func NewISODate() string
NewISODate creates a new RFC3339 date string using a javascript native call.
func NewPromise ¶
NewPromise constructs a new promise using a `(resolve, reject)` callback, similar to javascript.
func Require ¶
Require requires a module (only works in node or if a `require` polyfill is supplied).
func ThrowOnError ¶
func ThrowOnError(err error)
ThrowOnError throws when the supplied error is not nil.
Types ¶
This section is empty.