func (c *ServiceWorker) DispatchSyncEvent(ctx context.Context, origin string, registrationId string, tag string, lastChance bool) (*gcdmessage.ChromeResponse, error) {
	var v ServiceWorkerDispatchSyncEventParams
	v.Origin = origin
	v.RegistrationId = registrationId
	v.Tag = tag
	v.LastChance = lastChance
	return c.DispatchSyncEventWithParams(ctx, &v)
}
DispatchSyncEvent -
origin -
registrationId -
tag -
lastChance -
package gcdapi
import (
	"context"
	"github.com/wirepair/gcd/v2/gcdmessage"
)
type ServiceWorkerServiceWorkerRegistration struct {
	RegistrationId string `json:"registrationId"`  
	ScopeURL       string `json:"scopeURL"`        
	IsDeleted      bool   `json:"isDeleted"`       
}
type ServiceWorkerServiceWorkerVersion struct {
	VersionId          string   `json:"versionId"`                     
	RegistrationId     string   `json:"registrationId"`                
	ScriptURL          string   `json:"scriptURL"`                     
	RunningStatus      string   `json:"runningStatus"`                 
	Status             string   `json:"status"`                        
	ScriptLastModified float64  `json:"scriptLastModified,omitempty"`  
	ScriptResponseTime float64  `json:"scriptResponseTime,omitempty"`  
	ControlledClients  []string `json:"controlledClients,omitempty"`   
	TargetId           string   `json:"targetId,omitempty"`            
}
type ServiceWorkerServiceWorkerErrorMessage struct {
	ErrorMessage   string `json:"errorMessage"`    
	RegistrationId string `json:"registrationId"`  
	VersionId      string `json:"versionId"`       
	SourceURL      string `json:"sourceURL"`       
	LineNumber     int    `json:"lineNumber"`      
	ColumnNumber   int    `json:"columnNumber"`    
}
type ServiceWorkerWorkerErrorReportedEvent struct {
	Method string `json:"method"`
	Params struct {
		ErrorMessage *ServiceWorkerServiceWorkerErrorMessage `json:"errorMessage"`  
	} `json:"Params,omitempty"`
}
type ServiceWorkerWorkerRegistrationUpdatedEvent struct {
	Method string `json:"method"`
	Params struct {
		Registrations []*ServiceWorkerServiceWorkerRegistration `json:"registrations"`  
	} `json:"Params,omitempty"`
}
type ServiceWorkerWorkerVersionUpdatedEvent struct {
	Method string `json:"method"`
	Params struct {
		Versions []*ServiceWorkerServiceWorkerVersion `json:"versions"`  
	} `json:"Params,omitempty"`
}
type ServiceWorker struct {
	target gcdmessage.ChromeTargeter
}
func NewServiceWorker(target gcdmessage.ChromeTargeter) *ServiceWorker {
	c := &ServiceWorker{target: target}
	return c
}
type ServiceWorkerDeliverPushMessageParams struct {
	Origin string `json:"origin"`
	RegistrationId string `json:"registrationId"`
	Data string `json:"data"`
}
func (c *ServiceWorker) DeliverPushMessageWithParams(ctx context.Context, v *ServiceWorkerDeliverPushMessageParams) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "ServiceWorker.deliverPushMessage", Params: v})
}
func (c *ServiceWorker) DeliverPushMessage(ctx context.Context, origin string, registrationId string, data string) (*gcdmessage.ChromeResponse, error) {
	var v ServiceWorkerDeliverPushMessageParams
	v.Origin = origin
	v.RegistrationId = registrationId
	v.Data = data
	return c.DeliverPushMessageWithParams(ctx, &v)
}
func (c *ServiceWorker) Disable(ctx context.Context) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "ServiceWorker.disable"})
}
type ServiceWorkerDispatchSyncEventParams struct {
	Origin string `json:"origin"`
	RegistrationId string `json:"registrationId"`
	Tag string `json:"tag"`
	LastChance bool `json:"lastChance"`
}
func (c *ServiceWorker) DispatchSyncEventWithParams(ctx context.Context, v *ServiceWorkerDispatchSyncEventParams) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "ServiceWorker.dispatchSyncEvent", Params: v})
}