package domstorage
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
type ClearParams struct {
StorageID *StorageID `json:"storageId"`
}
func Clear (storageID *StorageID ) *ClearParams {
return &ClearParams {
StorageID : storageID ,
}
}
func (p *ClearParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandClear , p , nil )
}
type DisableParams struct {}
func Disable () *DisableParams {
return &DisableParams {}
}
func (p *DisableParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandDisable , nil , nil )
}
type EnableParams struct {}
func Enable () *EnableParams {
return &EnableParams {}
}
func (p *EnableParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandEnable , nil , nil )
}
type GetDOMStorageItemsParams struct {
StorageID *StorageID `json:"storageId"`
}
func GetDOMStorageItems (storageID *StorageID ) *GetDOMStorageItemsParams {
return &GetDOMStorageItemsParams {
StorageID : storageID ,
}
}
type GetDOMStorageItemsReturns struct {
Entries []Item `json:"entries,omitempty"`
}
func (p *GetDOMStorageItemsParams ) Do (ctx context .Context ) (entries []Item , err error ) {
var res GetDOMStorageItemsReturns
err = cdp .Execute (ctx , CommandGetDOMStorageItems , p , &res )
if err != nil {
return nil , err
}
return res .Entries , nil
}
type RemoveDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
}
func RemoveDOMStorageItem (storageID *StorageID , key string ) *RemoveDOMStorageItemParams {
return &RemoveDOMStorageItemParams {
StorageID : storageID ,
Key : key ,
}
}
func (p *RemoveDOMStorageItemParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandRemoveDOMStorageItem , p , nil )
}
type SetDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
Value string `json:"value"`
}
func SetDOMStorageItem (storageID *StorageID , key string , value string ) *SetDOMStorageItemParams {
return &SetDOMStorageItemParams {
StorageID : storageID ,
Key : key ,
Value : value ,
}
}
func (p *SetDOMStorageItemParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetDOMStorageItem , p , nil )
}
const (
CommandClear = "DOMStorage.clear"
CommandDisable = "DOMStorage.disable"
CommandEnable = "DOMStorage.enable"
CommandGetDOMStorageItems = "DOMStorage.getDOMStorageItems"
CommandRemoveDOMStorageItem = "DOMStorage.removeDOMStorageItem"
CommandSetDOMStorageItem = "DOMStorage.setDOMStorageItem"
)
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .