localstate

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package localstate provides utilities for accessing the browser's Local State file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(bt browser.Type, localState interface{}) error

Marshal will update Local State with localState. localState includes pref names and pref values that will be written to local state. pref name with dot format "foo.bar.baz" is not allowed in localState interface. localState could include nested map type {"foo":{"bar":{"baz": 1234}}}.

func MarshalPref

func MarshalPref(bt browser.Type, pref string, val interface{}) error

MarshalPref will update the pref with val in local state. pref name could have format "foo.bar.baz". Each component separated by '.' will be used as key of the dict. pref must not be an empty string.

func Unmarshal

func Unmarshal(bt browser.Type, out interface{}) error

Unmarshal performs json.Unmarshal on the contents of the browser's Local State file.

func UnmarshalPref

func UnmarshalPref(bt browser.Type, pref string) (interface{}, error)

UnmarshalPref returns the unmarshaled value of a preference from the browser's Local State file. The preference name is a string such as "foo.bar.baz".

Types

This section is empty.

Jump to

Keyboard shortcuts

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