Documentation
¶
Rendered for js/wasm
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cookie ¶
type CookieStore ¶ added in v0.0.8
func GetCookieStore ¶ added in v0.0.8
func GetCookieStore() *CookieStore
Returns the global CookieStore instance.
func (*CookieStore) Delete ¶ added in v0.0.8
func (cookiestore *CookieStore) Delete(options DeleteOptions) error
Deletes a matching Cookie from the CookieStore.
Example ¶
// import "github.com/cookiengineer/gooey/bindings/console"
console := console.GetConsole()
cookiestore := GetCookieStore()
err := cookiestore.Delete(DeleteOptions{
Name: "username",
Domain: "example.com",
Path: "/login",
Partitioned: true,
})
if err == nil {
console.Info("Cookie \"username\" deleted!")
} else {
console.Error(err)
}
func (*CookieStore) Get ¶ added in v0.0.8
func (cookiestore *CookieStore) Get(options GetOptions) (*Cookie, error)
Returns a matching Cookie from the CookieStore.
Example ¶
// import "github.com/cookiengineer/gooey/bindings/console"
console := console.GetConsole()
cookiestore := GetCookieStore()
cookie, err := cookiestore.Get(GetOptions{
Name: "username",
Url: "https://example.com/login",
})
if err == nil {
// Cookie{
// Domain: "example.com",
// Expires: 1767139200000,
// Name: "username",
// Partitioned: true,
// Path: "/login",
// SameSite: SameSite("strict"),
// Secure: true,
// Value: "cookiengineer",
// }
console.Info(cookie)
} else {
console.Error(err)
}
func (*CookieStore) GetAll ¶ added in v0.0.8
func (cookiestore *CookieStore) GetAll(options *GetOptions) ([]*Cookie, error)
Returns all matching Cookies from the CookieStore.
Example ¶
// import "github.com/cookiengineer/gooey/bindings/console"
console := console.GetConsole()
cookiestore := GetCookieStore()
cookies, err := cookiestore.GetAll(GetOptions{
Name: "username",
Url: "https://example.com/login",
})
if err == nil {
// []Cookie{
// {
// Domain: "example.com",
// Expires: 1767139200000,
// Name: "username",
// Partitioned: true,
// Path: "/login",
// SameSite: SameSite("strict"),
// Secure: true,
// Value: "cookiengineer",
// }, {
// Domain: "example.com",
// Expires: 1767139200000,
// Name: "PHPSESSID",
// Partitioned: true,
// Path: "/login",
// SameSite: SameSite("strict"),
// Secure: false,
// Value: "13371337",
// }
// }
console.Info(cookies)
} else {
console.Error(err)
}
func (*CookieStore) Set ¶ added in v0.0.8
func (cookiestore *CookieStore) Set(options SetOptions) error
Stores a Cookie to the CookieStore.
Example ¶
// import "github.com/cookiengineer/gooey/bindings/console"
console := console.GetConsole()
cookiestore := GetCookieStore()
err := cookiestore.Set(SetOptions{
Domain: "example.com",
Expires: 1767139200000,
Name: "username",
Partitioned: true,
Path: "/login",
SameSite: &SameSite("strict"),
Secure: true,
Value: "cookiengineer",
})
if err == nil {
console.Info("Cookie \"username\" has been stored!")
} else {
console.Error(err)
}
type DeleteOptions ¶
type DeleteOptions struct {
Name string `json:"name"`
Domain string `json:"domian"`
Path string `json:"path"`
Partitioned bool `json:"partitioned"`
}
func (DeleteOptions) MapToJS ¶
func (options DeleteOptions) MapToJS() map[string]any
type GetOptions ¶
func (GetOptions) MapToJS ¶
func (options GetOptions) MapToJS() map[string]any
type SetOptions ¶
type SetOptions struct {
Domain string `json:"domain"`
Expires int `json:"expires"`
Name string `json:"name"`
Partitioned bool `json:"partitioned"`
Path string `json:"path"`
SameSite *SameSite `json:"sameSite"`
Value string `json:"value"`
}
func (SetOptions) MapToJS ¶
func (options SetOptions) MapToJS() map[string]any
Click to show internal directories.
Click to hide internal directories.