normalized the names of the exposed jsvm bind funcs
This commit is contained in:
@@ -774,7 +774,7 @@ func BindFilesystem(vm *goja.Runtime) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindFilesystem registers $filepath.* namespaced object with
|
// BindFilepath registers $filepath.* namespaced object with
|
||||||
// common std Go filepath package related exports.
|
// common std Go filepath package related exports.
|
||||||
//
|
//
|
||||||
// See https://pocketbase.io/jsvm/modules/_filepath.html.
|
// See https://pocketbase.io/jsvm/modules/_filepath.html.
|
||||||
@@ -799,11 +799,11 @@ func BindFilepath(vm *goja.Runtime) {
|
|||||||
obj.Set("walkDir", filepath.WalkDir)
|
obj.Set("walkDir", filepath.WalkDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindFilesystem registers $os.* namespaced object with
|
// BindOS registers $os.* namespaced object with
|
||||||
// common std Go os package related exports.
|
// common std Go os package related exports.
|
||||||
//
|
//
|
||||||
// See https://pocketbase.io/jsvm/modules/_os.html.
|
// See https://pocketbase.io/jsvm/modules/_os.html.
|
||||||
func BindOs(vm *goja.Runtime) {
|
func BindOS(vm *goja.Runtime) {
|
||||||
obj := vm.NewObject()
|
obj := vm.NewObject()
|
||||||
vm.Set("$os", obj)
|
vm.Set("$os", obj)
|
||||||
|
|
||||||
@@ -881,11 +881,11 @@ func BindApis(vm *goja.Runtime) {
|
|||||||
registerFactoryAsConstructor(vm, "InternalServerError", router.NewInternalServerError)
|
registerFactoryAsConstructor(vm, "InternalServerError", router.NewInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindHttpClient registers $http.* namespaced object with common utils
|
// BindHTTP registers $http.* namespaced object with common utils
|
||||||
// for sending HTTP requests.
|
// for sending HTTP requests.
|
||||||
//
|
//
|
||||||
// See https://pocketbase.io/jsvm/modules/_http.html.
|
// See https://pocketbase.io/jsvm/modules/_http.html.
|
||||||
func BindHttpClient(vm *goja.Runtime) {
|
func BindHTTP(vm *goja.Runtime) {
|
||||||
obj := vm.NewObject()
|
obj := vm.NewObject()
|
||||||
vm.Set("$http", obj)
|
vm.Set("$http", obj)
|
||||||
|
|
||||||
|
|||||||
@@ -1391,18 +1391,18 @@ func TestLoadingArrayOf(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBindHttpClientCount(t *testing.T) {
|
func TestBindHTTPCount(t *testing.T) {
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
vm := goja.New()
|
vm := goja.New()
|
||||||
BindHttpClient(vm)
|
BindHTTP(vm)
|
||||||
|
|
||||||
testBindsCount(vm, "this", 2, t) // + FormData
|
testBindsCount(vm, "this", 2, t) // + FormData
|
||||||
testBindsCount(vm, "$http", 1, t)
|
testBindsCount(vm, "$http", 1, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBindHttpClientSend(t *testing.T) {
|
func TestBindHTTPSend(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
// start a test server
|
// start a test server
|
||||||
@@ -1448,7 +1448,7 @@ func TestBindHttpClientSend(t *testing.T) {
|
|||||||
|
|
||||||
vm := goja.New()
|
vm := goja.New()
|
||||||
BindCore(vm)
|
BindCore(vm)
|
||||||
BindHttpClient(vm)
|
BindHTTP(vm)
|
||||||
vm.Set("testURL", server.URL)
|
vm.Set("testURL", server.URL)
|
||||||
|
|
||||||
_, err := vm.RunString(`
|
_, err := vm.RunString(`
|
||||||
@@ -1862,9 +1862,9 @@ func TestBindFilepathCount(t *testing.T) {
|
|||||||
testBindsCount(vm, "$filepath", 15, t)
|
testBindsCount(vm, "$filepath", 15, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBindOsCount(t *testing.T) {
|
func TestBindOSCount(t *testing.T) {
|
||||||
vm := goja.New()
|
vm := goja.New()
|
||||||
BindOs(vm)
|
BindOS(vm)
|
||||||
|
|
||||||
testBindsCount(vm, "$os", 20, t)
|
testBindsCount(vm, "$os", 20, t)
|
||||||
}
|
}
|
||||||
|
|||||||
6994
plugins/jsvm/internal/types/generated/types.d.ts
vendored
6994
plugins/jsvm/internal/types/generated/types.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -206,9 +206,9 @@ func (p *plugin) registerMigrations() error {
|
|||||||
BindCore(vm)
|
BindCore(vm)
|
||||||
BindDbx(vm)
|
BindDbx(vm)
|
||||||
BindSecurity(vm)
|
BindSecurity(vm)
|
||||||
BindOs(vm)
|
BindOS(vm)
|
||||||
BindFilepath(vm)
|
BindFilepath(vm)
|
||||||
BindHttpClient(vm)
|
BindHTTP(vm)
|
||||||
BindFilesystem(vm)
|
BindFilesystem(vm)
|
||||||
BindForms(vm)
|
BindForms(vm)
|
||||||
BindMails(vm)
|
BindMails(vm)
|
||||||
@@ -294,9 +294,9 @@ func (p *plugin) registerHooks() error {
|
|||||||
BindCore(vm)
|
BindCore(vm)
|
||||||
BindDbx(vm)
|
BindDbx(vm)
|
||||||
BindSecurity(vm)
|
BindSecurity(vm)
|
||||||
BindOs(vm)
|
BindOS(vm)
|
||||||
BindFilepath(vm)
|
BindFilepath(vm)
|
||||||
BindHttpClient(vm)
|
BindHTTP(vm)
|
||||||
BindFilesystem(vm)
|
BindFilesystem(vm)
|
||||||
BindForms(vm)
|
BindForms(vm)
|
||||||
BindMails(vm)
|
BindMails(vm)
|
||||||
|
|||||||
Reference in New Issue
Block a user