jssdk

package
v0.3.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CSR_NO_OP_ALERT = `window.alert = () => {};window.prompt = () => {}`
View Source
const TPL_MIX_JS = `()=> document.documentElement.innerHTML`

MIX mode

Variables

View Source
var FILE_DATE_JS string
View Source
var FILE_HEP_JS string
View Source
var FILE_MOMENT_JS string
View Source
var FILE_SDK string
View Source
var FILE_SHIM_CSR string
View Source
var FILE_SHIM_SSR string
View Source
var GenerateCSRInjectParser = func(app []byte) string {
	return fmt.Sprintf("()=> (function(window){\n%s;\nvar potted = new POTTED();\n%s;\npotted.GetData();return potted.value;})(window)", TPL_CSR_JS, app)
}

mix csr sdk and csr app for cdp client

View Source
var GenerateInspector = func(app []byte) string {
	return fmt.Sprintf("<script>%s;\n%s;\n</script>", FILE_HEP_JS, app)
}

mix hep.js and inspector js for inspector page

View Source
var TPL_CSR_JS = func() string {
	return fmt.Sprintf("%s\n%s", FILE_SHIM_CSR, FILE_SDK)
}()

combine sdk and csr shim for CSR

View Source
var TPL_DATE_JS = func() string {
	return fmt.Sprintf("%s\n%s", FILE_MOMENT_JS, FILE_DATE_JS)
}()

combine moment.js with date functions

View Source
var TPL_SSR_JS = func() string {
	return fmt.Sprintf("%s\n%s", FILE_SHIM_SSR, FILE_SDK)
}()

combine sdk and ssr shim for SSR

Functions

func ConvertAgoToUnix

func ConvertAgoToUnix(date string) (time.Time, error)

func ConvertStrToUnix

func ConvertStrToUnix(str string) (time.Time, error)

func GenerateGetConfigWithRule

func GenerateGetConfigWithRule(rule []byte) string

mix rule with template, generate get config function for RSS Can

func GetCtxWithJS

func GetCtxWithJS(basejs string) (*v8.Context, error)

func RunCode

func RunCode(base string, export string) (string, error)

func RunCodeInSandbox

func RunCodeInSandbox(ctx *v8.Context, unsafe string, fileName string) (*v8.Value, time.Duration, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL