package jscache

import "github.com/hack-pad/go-indexeddb/idb/internal/jscache"

Package jscache caches expensive JavaScript results, like string encoding

Index

Types

type Strings

type Strings struct {
	// contains filtered or unexported fields
}

Strings caches encoding strings as safejs.Value's. String encoding today is quite CPU intensive, so caching commonly used strings helps with performance.

func (*Strings) GetProperty

func (c *Strings) GetProperty(obj safejs.Value, key string) (safejs.Value, error)

GetProperty retrieves the given object's property, using a cached string value if available. Saves on the performance cost of 2 round trips to JS.

func (*Strings) Value

func (c *Strings) Value(s string) safejs.Value

Value retrieves the safejs.Value for the given string

Source Files

cacher.go strings.go

Version
v0.3.1
Published
Jan 29, 2023
Platform
js/wasm
Imports
1 packages
Last checked
4 hours ago

Tools for package owners.