001package Torello.Browser;
002
003import java.util.*;
004import javax.json.*;
005import javax.json.stream.*;
006import java.io.*;
007
008import java.lang.reflect.Method;
009import java.lang.reflect.Parameter;
010import java.util.function.Function;
011
012import Torello.Java.Additional.*;
013
014import static Torello.Java.Additional.JFlag.*;
015
016import Torello.Java.StrCmpr;
017import Torello.JavaDoc.StaticFunctional;
018import Torello.JavaDoc.JDHeaderBackgroundImg;
019import Torello.JavaDoc.Excuse;
020
021/**
022 * <SPAN CLASS=CopiedJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN>
023 * 
024 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
025 */
026@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
027@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
028public class ServiceWorker
029{
030    // ********************************************************************************************
031    // ********************************************************************************************
032    // Class Header Stuff
033    // ********************************************************************************************
034    // ********************************************************************************************
035
036
037    // No Pubic Constructors
038    private ServiceWorker () { }
039
040    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
041    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
042    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
043    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();
044
045    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
046    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
047    // offically, two empty-vectors.  One for String's, and the other for Classes.
048
049    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
050    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();
051
052    static
053    {
054        for (Method m : ServiceWorker.class.getMethods())
055        {
056            // This doesn't work!  The parameter names are all "arg0" ... "argN"
057            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
058            //
059            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!
060
061            Vector<Class<?>> parameterTypesList = new Vector<>();
062        
063            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());
064
065            parameterTypes.put(
066                m.getName(),
067                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
068            );
069        }
070    }
071
072    static
073    {
074        Vector<String> v = null;
075
076        v = new Vector<String>(3);
077        parameterNames.put("deliverPushMessage", v);
078        Collections.addAll(v, new String[]
079        { "origin", "registrationId", "data", });
080
081        parameterNames.put("disable", EMPTY_VEC_STR);
082
083        v = new Vector<String>(4);
084        parameterNames.put("dispatchSyncEvent", v);
085        Collections.addAll(v, new String[]
086        { "origin", "registrationId", "tag", "lastChance", });
087
088        v = new Vector<String>(3);
089        parameterNames.put("dispatchPeriodicSyncEvent", v);
090        Collections.addAll(v, new String[]
091        { "origin", "registrationId", "tag", });
092
093        parameterNames.put("enable", EMPTY_VEC_STR);
094
095        v = new Vector<String>(1);
096        parameterNames.put("inspectWorker", v);
097        Collections.addAll(v, new String[]
098        { "versionId", });
099
100        v = new Vector<String>(1);
101        parameterNames.put("setForceUpdateOnPageLoad", v);
102        Collections.addAll(v, new String[]
103        { "forceUpdateOnPageLoad", });
104
105        v = new Vector<String>(1);
106        parameterNames.put("skipWaiting", v);
107        Collections.addAll(v, new String[]
108        { "scopeURL", });
109
110        v = new Vector<String>(1);
111        parameterNames.put("startWorker", v);
112        Collections.addAll(v, new String[]
113        { "scopeURL", });
114
115        parameterNames.put("stopAllWorkers", EMPTY_VEC_STR);
116
117        v = new Vector<String>(1);
118        parameterNames.put("stopWorker", v);
119        Collections.addAll(v, new String[]
120        { "versionId", });
121
122        v = new Vector<String>(1);
123        parameterNames.put("unregister", v);
124        Collections.addAll(v, new String[]
125        { "scopeURL", });
126
127        v = new Vector<String>(1);
128        parameterNames.put("updateRegistration", v);
129        Collections.addAll(v, new String[]
130        { "scopeURL", });
131    }
132
133
134    // ********************************************************************************************
135    // ********************************************************************************************
136    // Types - Static Inner Classes
137    // ********************************************************************************************
138    // ********************************************************************************************
139
140    // public static class RegistrationID => String
141    
142    /** <CODE>[No Description Provided by Google]</CODE> */
143    public static final String[] ServiceWorkerVersionRunningStatus =
144    { "stopped", "starting", "running", "stopping", };
145    
146    /** <CODE>[No Description Provided by Google]</CODE> */
147    public static final String[] ServiceWorkerVersionStatus =
148    { "new", "installing", "installed", "activating", "activated", "redundant", };
149    
150    /** ServiceWorker registration. */
151    public static class ServiceWorkerRegistration extends BaseType
152    {
153        /** For Object Serialization.  java.io.Serializable */
154        protected static final long serialVersionUID = 1;
155        
156        public boolean[] optionals()
157        { return new boolean[] { false, false, false, }; }
158        
159        /** <CODE>[No Description Provided by Google]</CODE> */
160        public final String registrationId;
161        
162        /** <CODE>[No Description Provided by Google]</CODE> */
163        public final String scopeURL;
164        
165        /** <CODE>[No Description Provided by Google]</CODE> */
166        public final boolean isDeleted;
167        
168        /**
169         * Constructor
170         *
171         * @param registrationId -
172         * 
173         * @param scopeURL -
174         * 
175         * @param isDeleted -
176         */
177        public ServiceWorkerRegistration
178            (String registrationId, String scopeURL, boolean isDeleted)
179        {
180            // Exception-Check(s) to ensure that if any parameters which are not declared as
181            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
182            
183            if (registrationId == null) BRDPC.throwNPE("registrationId");
184            if (scopeURL == null)       BRDPC.throwNPE("scopeURL");
185            
186            this.registrationId  = registrationId;
187            this.scopeURL        = scopeURL;
188            this.isDeleted       = isDeleted;
189        }
190        
191        /**
192         * JSON Object Constructor
193         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerRegistration'}.
194         */
195        public ServiceWorkerRegistration (JsonObject jo)
196        {
197            this.registrationId  = ReadJSON.getString(jo, "registrationId", false, true);
198            this.scopeURL        = ReadJSON.getString(jo, "scopeURL", false, true);
199            this.isDeleted       = ReadJSON.getBoolean(jo, "isDeleted");
200        }
201        
202    }
203    
204    /** ServiceWorker version. */
205    public static class ServiceWorkerVersion extends BaseType
206    {
207        /** For Object Serialization.  java.io.Serializable */
208        protected static final long serialVersionUID = 1;
209        
210        public boolean[] optionals()
211        { return new boolean[] { false, false, false, false, false, true, true, true, true, }; }
212        
213        /** <CODE>[No Description Provided by Google]</CODE> */
214        public final String versionId;
215        
216        /** <CODE>[No Description Provided by Google]</CODE> */
217        public final String registrationId;
218        
219        /** <CODE>[No Description Provided by Google]</CODE> */
220        public final String scriptURL;
221        
222        /** <CODE>[No Description Provided by Google]</CODE> */
223        public final String runningStatus;
224        
225        /** <CODE>[No Description Provided by Google]</CODE> */
226        public final String status;
227        
228        /**
229         * The Last-Modified header value of the main script.
230         * <BR />
231         * <BR /><B>OPTIONAL</B>
232         */
233        public final Number scriptLastModified;
234        
235        /**
236         * The time at which the response headers of the main script were received from the server.
237         * For cached script it is the last time the cache entry was validated.
238         * <BR />
239         * <BR /><B>OPTIONAL</B>
240         */
241        public final Number scriptResponseTime;
242        
243        /**
244         * <CODE>[No Description Provided by Google]</CODE>
245         * <BR />
246         * <BR /><B>OPTIONAL</B>
247         */
248        public final String[] controlledClients;
249        
250        /**
251         * <CODE>[No Description Provided by Google]</CODE>
252         * <BR />
253         * <BR /><B>OPTIONAL</B>
254         */
255        public final String targetId;
256        
257        /**
258         * Constructor
259         *
260         * @param versionId -
261         * 
262         * @param registrationId -
263         * 
264         * @param scriptURL -
265         * 
266         * @param runningStatus -
267         * 
268         * @param status -
269         * 
270         * @param scriptLastModified The Last-Modified header value of the main script.
271         * <BR /><B>OPTIONAL</B>
272         * 
273         * @param scriptResponseTime 
274         * The time at which the response headers of the main script were received from the server.
275         * For cached script it is the last time the cache entry was validated.
276         * <BR /><B>OPTIONAL</B>
277         * 
278         * @param controlledClients -
279         * <BR /><B>OPTIONAL</B>
280         * 
281         * @param targetId -
282         * <BR /><B>OPTIONAL</B>
283         */
284        public ServiceWorkerVersion(
285                String versionId, String registrationId, String scriptURL, String runningStatus, 
286                String status, Number scriptLastModified, Number scriptResponseTime, 
287                String[] controlledClients, String targetId
288            )
289        {
290            // Exception-Check(s) to ensure that if any parameters which are not declared as
291            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
292            
293            if (versionId == null)      BRDPC.throwNPE("versionId");
294            if (registrationId == null) BRDPC.throwNPE("registrationId");
295            if (scriptURL == null)      BRDPC.throwNPE("scriptURL");
296            if (runningStatus == null)  BRDPC.throwNPE("runningStatus");
297            if (status == null)         BRDPC.throwNPE("status");
298            
299            // Exception-Check(s) to ensure that if any parameters which must adhere to a
300            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
301            
302            BRDPC.checkIAE("runningStatus", runningStatus, "ServiceWorker.ServiceWorkerVersionRunningStatus", ServiceWorker.ServiceWorkerVersionRunningStatus);
303            BRDPC.checkIAE("status", status, "ServiceWorker.ServiceWorkerVersionStatus", ServiceWorker.ServiceWorkerVersionStatus);
304            
305            this.versionId           = versionId;
306            this.registrationId      = registrationId;
307            this.scriptURL           = scriptURL;
308            this.runningStatus       = runningStatus;
309            this.status              = status;
310            this.scriptLastModified  = scriptLastModified;
311            this.scriptResponseTime  = scriptResponseTime;
312            this.controlledClients   = controlledClients;
313            this.targetId            = targetId;
314        }
315        
316        /**
317         * JSON Object Constructor
318         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerVersion'}.
319         */
320        public ServiceWorkerVersion (JsonObject jo)
321        {
322            this.versionId           = ReadJSON.getString(jo, "versionId", false, true);
323            this.registrationId      = ReadJSON.getString(jo, "registrationId", false, true);
324            this.scriptURL           = ReadJSON.getString(jo, "scriptURL", false, true);
325            this.runningStatus       = ReadJSON.getString(jo, "runningStatus", false, true);
326            this.status              = ReadJSON.getString(jo, "status", false, true);
327            this.scriptLastModified  = ReadJSON.getNUMBER(jo, "scriptLastModified", true, false);
328            this.scriptResponseTime  = ReadJSON.getNUMBER(jo, "scriptResponseTime", true, false);
329            this.controlledClients   = (jo.getJsonArray("controlledClients") == null)
330            ? null
331            : ReadArrJSON.DimN.strArr(jo.getJsonArray("controlledClients"), null, 0, String[].class);
332            this.targetId            = ReadJSON.getString(jo, "targetId", true, false);
333        }
334        
335    }
336    
337    /** ServiceWorker error message. */
338    public static class ServiceWorkerErrorMessage extends BaseType
339    {
340        /** For Object Serialization.  java.io.Serializable */
341        protected static final long serialVersionUID = 1;
342        
343        public boolean[] optionals()
344        { return new boolean[] { false, false, false, false, false, false, }; }
345        
346        /** <CODE>[No Description Provided by Google]</CODE> */
347        public final String errorMessage;
348        
349        /** <CODE>[No Description Provided by Google]</CODE> */
350        public final String registrationId;
351        
352        /** <CODE>[No Description Provided by Google]</CODE> */
353        public final String versionId;
354        
355        /** <CODE>[No Description Provided by Google]</CODE> */
356        public final String sourceURL;
357        
358        /** <CODE>[No Description Provided by Google]</CODE> */
359        public final int lineNumber;
360        
361        /** <CODE>[No Description Provided by Google]</CODE> */
362        public final int columnNumber;
363        
364        /**
365         * Constructor
366         *
367         * @param errorMessage -
368         * 
369         * @param registrationId -
370         * 
371         * @param versionId -
372         * 
373         * @param sourceURL -
374         * 
375         * @param lineNumber -
376         * 
377         * @param columnNumber -
378         */
379        public ServiceWorkerErrorMessage(
380                String errorMessage, String registrationId, String versionId, String sourceURL, 
381                int lineNumber, int columnNumber
382            )
383        {
384            // Exception-Check(s) to ensure that if any parameters which are not declared as
385            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
386            
387            if (errorMessage == null)   BRDPC.throwNPE("errorMessage");
388            if (registrationId == null) BRDPC.throwNPE("registrationId");
389            if (versionId == null)      BRDPC.throwNPE("versionId");
390            if (sourceURL == null)      BRDPC.throwNPE("sourceURL");
391            
392            this.errorMessage    = errorMessage;
393            this.registrationId  = registrationId;
394            this.versionId       = versionId;
395            this.sourceURL       = sourceURL;
396            this.lineNumber      = lineNumber;
397            this.columnNumber    = columnNumber;
398        }
399        
400        /**
401         * JSON Object Constructor
402         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerErrorMessage'}.
403         */
404        public ServiceWorkerErrorMessage (JsonObject jo)
405        {
406            this.errorMessage    = ReadJSON.getString(jo, "errorMessage", false, true);
407            this.registrationId  = ReadJSON.getString(jo, "registrationId", false, true);
408            this.versionId       = ReadJSON.getString(jo, "versionId", false, true);
409            this.sourceURL       = ReadJSON.getString(jo, "sourceURL", false, true);
410            this.lineNumber      = ReadJSON.getInt(jo, "lineNumber");
411            this.columnNumber    = ReadJSON.getInt(jo, "columnNumber");
412        }
413        
414    }
415    
416    /** <CODE>[No Description Provided by Google]</CODE> */
417    public static class workerErrorReported extends BrowserEvent
418    {
419        /** For Object Serialization.  java.io.Serializable */
420        protected static final long serialVersionUID = 1;
421        
422        public boolean[] optionals()
423        { return new boolean[] { false, }; }
424        
425        /** <CODE>[No Description Provided by Google]</CODE> */
426        public final ServiceWorker.ServiceWorkerErrorMessage errorMessage;
427        
428        /**
429         * Constructor
430         *
431         * @param errorMessage -
432         */
433        public workerErrorReported(ServiceWorker.ServiceWorkerErrorMessage errorMessage)
434        {
435            super("ServiceWorker", "workerErrorReported", 1);
436            
437            // Exception-Check(s) to ensure that if any parameters which are not declared as
438            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
439            
440            if (errorMessage == null) BRDPC.throwNPE("errorMessage");
441            
442            this.errorMessage  = errorMessage;
443        }
444        
445        /**
446         * JSON Object Constructor
447         * @param jo A Json-Object having data about an instance of {@code 'workerErrorReported'}.
448         */
449        public workerErrorReported (JsonObject jo)
450        {
451            super("ServiceWorker", "workerErrorReported", 1);
452        
453            this.errorMessage  = ReadJSON.XL.getObject(jo, "errorMessage", ServiceWorker.ServiceWorkerErrorMessage.class, false, true);
454        }
455        
456    }
457    
458    /** <CODE>[No Description Provided by Google]</CODE> */
459    public static class workerRegistrationUpdated extends BrowserEvent
460    {
461        /** For Object Serialization.  java.io.Serializable */
462        protected static final long serialVersionUID = 1;
463        
464        public boolean[] optionals()
465        { return new boolean[] { false, }; }
466        
467        /** <CODE>[No Description Provided by Google]</CODE> */
468        public final ServiceWorker.ServiceWorkerRegistration[] registrations;
469        
470        /**
471         * Constructor
472         *
473         * @param registrations -
474         */
475        public workerRegistrationUpdated
476            (ServiceWorker.ServiceWorkerRegistration[] registrations)
477        {
478            super("ServiceWorker", "workerRegistrationUpdated", 1);
479            
480            // Exception-Check(s) to ensure that if any parameters which are not declared as
481            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
482            
483            if (registrations == null) BRDPC.throwNPE("registrations");
484            
485            this.registrations  = registrations;
486        }
487        
488        /**
489         * JSON Object Constructor
490         * @param jo A Json-Object having data about an instance of {@code 'workerRegistrationUpdated'}.
491         */
492        public workerRegistrationUpdated (JsonObject jo)
493        {
494            super("ServiceWorker", "workerRegistrationUpdated", 1);
495        
496            this.registrations  = (jo.getJsonArray("registrations") == null)
497            ? null
498            : ReadArrJSON.DimN.objArr(jo.getJsonArray("registrations"), null, 0, ServiceWorker.ServiceWorkerRegistration[].class);
499        }
500        
501    }
502    
503    /** <CODE>[No Description Provided by Google]</CODE> */
504    public static class workerVersionUpdated extends BrowserEvent
505    {
506        /** For Object Serialization.  java.io.Serializable */
507        protected static final long serialVersionUID = 1;
508        
509        public boolean[] optionals()
510        { return new boolean[] { false, }; }
511        
512        /** <CODE>[No Description Provided by Google]</CODE> */
513        public final ServiceWorker.ServiceWorkerVersion[] versions;
514        
515        /**
516         * Constructor
517         *
518         * @param versions -
519         */
520        public workerVersionUpdated(ServiceWorker.ServiceWorkerVersion[] versions)
521        {
522            super("ServiceWorker", "workerVersionUpdated", 1);
523            
524            // Exception-Check(s) to ensure that if any parameters which are not declared as
525            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
526            
527            if (versions == null) BRDPC.throwNPE("versions");
528            
529            this.versions  = versions;
530        }
531        
532        /**
533         * JSON Object Constructor
534         * @param jo A Json-Object having data about an instance of {@code 'workerVersionUpdated'}.
535         */
536        public workerVersionUpdated (JsonObject jo)
537        {
538            super("ServiceWorker", "workerVersionUpdated", 1);
539        
540            this.versions  = (jo.getJsonArray("versions") == null)
541            ? null
542            : ReadArrJSON.DimN.objArr(jo.getJsonArray("versions"), null, 0, ServiceWorker.ServiceWorkerVersion[].class);
543        }
544        
545    }
546    
547    
548    // Counter for keeping the WebSocket Request ID's distinct.
549    private static int counter = 1;
550    
551    /**
552     * <CODE>[No Description Provided by Google]</CODE>
553     * 
554     * @param origin -
555     * 
556     * @param registrationId -
557     * 
558     * @param data -
559     * 
560     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
561     * {@link Ret0}&gt;</CODE>
562     *
563     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
564     * browser receives the invocation-request.
565     *
566     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
567     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
568     * {@code >} to ensure the Browser Function has run to completion.
569     */
570    public static Script<String, JsonObject, Ret0> deliverPushMessage
571        (String origin, String registrationId, String data)
572    {
573        // Exception-Check(s) to ensure that if any parameters which are not declared as
574        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
575        
576        if (origin == null)         BRDPC.throwNPE("origin");
577        if (registrationId == null) BRDPC.throwNPE("registrationId");
578        if (data == null)           BRDPC.throwNPE("data");
579        
580        final int       webSocketID = 36000000 + counter++;
581        final boolean[] optionals   = { false, false, false, };
582        
583        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
584        String requestJSON = WriteJSON.get(
585            parameterTypes.get("deliverPushMessage"),
586            parameterNames.get("deliverPushMessage"),
587            optionals, webSocketID,
588            "ServiceWorker.deliverPushMessage",
589            origin, registrationId, data
590        );
591        
592        // This Remote Command does not have a Return-Value.
593        return new Script<>
594            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
595    }
596    
597    /**
598     * <CODE>[No Description Provided by Google]</CODE>
599     * 
600     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
601     * {@link Ret0}&gt;</CODE>
602     *
603     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
604     * browser receives the invocation-request.
605     *
606     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
607     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
608     * {@code >} to ensure the Browser Function has run to completion.
609     */
610    public static Script<String, JsonObject, Ret0> disable()
611    {
612        final int          webSocketID = 36001000 + counter++;
613        final boolean[]    optionals   = new boolean[0];
614        
615        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
616        String requestJSON = WriteJSON.get(
617            parameterTypes.get("disable"),
618            parameterNames.get("disable"),
619            optionals, webSocketID,
620            "ServiceWorker.disable"
621        );
622        
623        // This Remote Command does not have a Return-Value.
624        return new Script<>
625            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
626    }
627    
628    /**
629     * <CODE>[No Description Provided by Google]</CODE>
630     * 
631     * @param origin -
632     * 
633     * @param registrationId -
634     * 
635     * @param tag -
636     * 
637     * @param lastChance -
638     * 
639     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
640     * {@link Ret0}&gt;</CODE>
641     *
642     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
643     * browser receives the invocation-request.
644     *
645     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
646     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
647     * {@code >} to ensure the Browser Function has run to completion.
648     */
649    public static Script<String, JsonObject, Ret0> dispatchSyncEvent
650        (String origin, String registrationId, String tag, boolean lastChance)
651    {
652        // Exception-Check(s) to ensure that if any parameters which are not declared as
653        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
654        
655        if (origin == null)         BRDPC.throwNPE("origin");
656        if (registrationId == null) BRDPC.throwNPE("registrationId");
657        if (tag == null)            BRDPC.throwNPE("tag");
658        
659        final int       webSocketID = 36002000 + counter++;
660        final boolean[] optionals   = { false, false, false, false, };
661        
662        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
663        String requestJSON = WriteJSON.get(
664            parameterTypes.get("dispatchSyncEvent"),
665            parameterNames.get("dispatchSyncEvent"),
666            optionals, webSocketID,
667            "ServiceWorker.dispatchSyncEvent",
668            origin, registrationId, tag, lastChance
669        );
670        
671        // This Remote Command does not have a Return-Value.
672        return new Script<>
673            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
674    }
675    
676    /**
677     * <CODE>[No Description Provided by Google]</CODE>
678     * 
679     * @param origin -
680     * 
681     * @param registrationId -
682     * 
683     * @param tag -
684     * 
685     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
686     * {@link Ret0}&gt;</CODE>
687     *
688     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
689     * browser receives the invocation-request.
690     *
691     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
692     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
693     * {@code >} to ensure the Browser Function has run to completion.
694     */
695    public static Script<String, JsonObject, Ret0> dispatchPeriodicSyncEvent
696        (String origin, String registrationId, String tag)
697    {
698        // Exception-Check(s) to ensure that if any parameters which are not declared as
699        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
700        
701        if (origin == null)         BRDPC.throwNPE("origin");
702        if (registrationId == null) BRDPC.throwNPE("registrationId");
703        if (tag == null)            BRDPC.throwNPE("tag");
704        
705        final int       webSocketID = 36003000 + counter++;
706        final boolean[] optionals   = { false, false, false, };
707        
708        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
709        String requestJSON = WriteJSON.get(
710            parameterTypes.get("dispatchPeriodicSyncEvent"),
711            parameterNames.get("dispatchPeriodicSyncEvent"),
712            optionals, webSocketID,
713            "ServiceWorker.dispatchPeriodicSyncEvent",
714            origin, registrationId, tag
715        );
716        
717        // This Remote Command does not have a Return-Value.
718        return new Script<>
719            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
720    }
721    
722    /**
723     * <CODE>[No Description Provided by Google]</CODE>
724     * 
725     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
726     * {@link Ret0}&gt;</CODE>
727     *
728     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
729     * browser receives the invocation-request.
730     *
731     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
732     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
733     * {@code >} to ensure the Browser Function has run to completion.
734     */
735    public static Script<String, JsonObject, Ret0> enable()
736    {
737        final int          webSocketID = 36004000 + counter++;
738        final boolean[]    optionals   = new boolean[0];
739        
740        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
741        String requestJSON = WriteJSON.get(
742            parameterTypes.get("enable"),
743            parameterNames.get("enable"),
744            optionals, webSocketID,
745            "ServiceWorker.enable"
746        );
747        
748        // This Remote Command does not have a Return-Value.
749        return new Script<>
750            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
751    }
752    
753    /**
754     * <CODE>[No Description Provided by Google]</CODE>
755     * 
756     * @param versionId -
757     * 
758     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
759     * {@link Ret0}&gt;</CODE>
760     *
761     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
762     * browser receives the invocation-request.
763     *
764     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
765     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
766     * {@code >} to ensure the Browser Function has run to completion.
767     */
768    public static Script<String, JsonObject, Ret0> inspectWorker(String versionId)
769    {
770        // Exception-Check(s) to ensure that if any parameters which are not declared as
771        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
772        
773        if (versionId == null) BRDPC.throwNPE("versionId");
774        
775        final int       webSocketID = 36005000 + counter++;
776        final boolean[] optionals   = { false, };
777        
778        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
779        String requestJSON = WriteJSON.get(
780            parameterTypes.get("inspectWorker"),
781            parameterNames.get("inspectWorker"),
782            optionals, webSocketID,
783            "ServiceWorker.inspectWorker",
784            versionId
785        );
786        
787        // This Remote Command does not have a Return-Value.
788        return new Script<>
789            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
790    }
791    
792    /**
793     * <CODE>[No Description Provided by Google]</CODE>
794     * 
795     * @param forceUpdateOnPageLoad -
796     * 
797     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
798     * {@link Ret0}&gt;</CODE>
799     *
800     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
801     * browser receives the invocation-request.
802     *
803     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
804     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
805     * {@code >} to ensure the Browser Function has run to completion.
806     */
807    public static Script<String, JsonObject, Ret0> setForceUpdateOnPageLoad
808        (boolean forceUpdateOnPageLoad)
809    {
810        final int       webSocketID = 36006000 + counter++;
811        final boolean[] optionals   = { false, };
812        
813        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
814        String requestJSON = WriteJSON.get(
815            parameterTypes.get("setForceUpdateOnPageLoad"),
816            parameterNames.get("setForceUpdateOnPageLoad"),
817            optionals, webSocketID,
818            "ServiceWorker.setForceUpdateOnPageLoad",
819            forceUpdateOnPageLoad
820        );
821        
822        // This Remote Command does not have a Return-Value.
823        return new Script<>
824            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
825    }
826    
827    /**
828     * <CODE>[No Description Provided by Google]</CODE>
829     * 
830     * @param scopeURL -
831     * 
832     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
833     * {@link Ret0}&gt;</CODE>
834     *
835     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
836     * browser receives the invocation-request.
837     *
838     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
839     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
840     * {@code >} to ensure the Browser Function has run to completion.
841     */
842    public static Script<String, JsonObject, Ret0> skipWaiting(String scopeURL)
843    {
844        // Exception-Check(s) to ensure that if any parameters which are not declared as
845        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
846        
847        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
848        
849        final int       webSocketID = 36007000 + counter++;
850        final boolean[] optionals   = { false, };
851        
852        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
853        String requestJSON = WriteJSON.get(
854            parameterTypes.get("skipWaiting"),
855            parameterNames.get("skipWaiting"),
856            optionals, webSocketID,
857            "ServiceWorker.skipWaiting",
858            scopeURL
859        );
860        
861        // This Remote Command does not have a Return-Value.
862        return new Script<>
863            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
864    }
865    
866    /**
867     * <CODE>[No Description Provided by Google]</CODE>
868     * 
869     * @param scopeURL -
870     * 
871     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
872     * {@link Ret0}&gt;</CODE>
873     *
874     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
875     * browser receives the invocation-request.
876     *
877     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
878     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
879     * {@code >} to ensure the Browser Function has run to completion.
880     */
881    public static Script<String, JsonObject, Ret0> startWorker(String scopeURL)
882    {
883        // Exception-Check(s) to ensure that if any parameters which are not declared as
884        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
885        
886        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
887        
888        final int       webSocketID = 36008000 + counter++;
889        final boolean[] optionals   = { false, };
890        
891        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
892        String requestJSON = WriteJSON.get(
893            parameterTypes.get("startWorker"),
894            parameterNames.get("startWorker"),
895            optionals, webSocketID,
896            "ServiceWorker.startWorker",
897            scopeURL
898        );
899        
900        // This Remote Command does not have a Return-Value.
901        return new Script<>
902            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
903    }
904    
905    /**
906     * <CODE>[No Description Provided by Google]</CODE>
907     * 
908     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
909     * {@link Ret0}&gt;</CODE>
910     *
911     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
912     * browser receives the invocation-request.
913     *
914     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
915     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
916     * {@code >} to ensure the Browser Function has run to completion.
917     */
918    public static Script<String, JsonObject, Ret0> stopAllWorkers()
919    {
920        final int          webSocketID = 36009000 + counter++;
921        final boolean[]    optionals   = new boolean[0];
922        
923        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
924        String requestJSON = WriteJSON.get(
925            parameterTypes.get("stopAllWorkers"),
926            parameterNames.get("stopAllWorkers"),
927            optionals, webSocketID,
928            "ServiceWorker.stopAllWorkers"
929        );
930        
931        // This Remote Command does not have a Return-Value.
932        return new Script<>
933            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
934    }
935    
936    /**
937     * <CODE>[No Description Provided by Google]</CODE>
938     * 
939     * @param versionId -
940     * 
941     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
942     * {@link Ret0}&gt;</CODE>
943     *
944     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
945     * browser receives the invocation-request.
946     *
947     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
948     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
949     * {@code >} to ensure the Browser Function has run to completion.
950     */
951    public static Script<String, JsonObject, Ret0> stopWorker(String versionId)
952    {
953        // Exception-Check(s) to ensure that if any parameters which are not declared as
954        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
955        
956        if (versionId == null) BRDPC.throwNPE("versionId");
957        
958        final int       webSocketID = 36010000 + counter++;
959        final boolean[] optionals   = { false, };
960        
961        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
962        String requestJSON = WriteJSON.get(
963            parameterTypes.get("stopWorker"),
964            parameterNames.get("stopWorker"),
965            optionals, webSocketID,
966            "ServiceWorker.stopWorker",
967            versionId
968        );
969        
970        // This Remote Command does not have a Return-Value.
971        return new Script<>
972            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
973    }
974    
975    /**
976     * <CODE>[No Description Provided by Google]</CODE>
977     * 
978     * @param scopeURL -
979     * 
980     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
981     * {@link Ret0}&gt;</CODE>
982     *
983     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
984     * browser receives the invocation-request.
985     *
986     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
987     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
988     * {@code >} to ensure the Browser Function has run to completion.
989     */
990    public static Script<String, JsonObject, Ret0> unregister(String scopeURL)
991    {
992        // Exception-Check(s) to ensure that if any parameters which are not declared as
993        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
994        
995        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
996        
997        final int       webSocketID = 36011000 + counter++;
998        final boolean[] optionals   = { false, };
999        
1000        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1001        String requestJSON = WriteJSON.get(
1002            parameterTypes.get("unregister"),
1003            parameterNames.get("unregister"),
1004            optionals, webSocketID,
1005            "ServiceWorker.unregister",
1006            scopeURL
1007        );
1008        
1009        // This Remote Command does not have a Return-Value.
1010        return new Script<>
1011            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1012    }
1013    
1014    /**
1015     * <CODE>[No Description Provided by Google]</CODE>
1016     * 
1017     * @param scopeURL -
1018     * 
1019     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1020     * {@link Ret0}&gt;</CODE>
1021     *
1022     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1023     * browser receives the invocation-request.
1024     *
1025     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1026     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1027     * {@code >} to ensure the Browser Function has run to completion.
1028     */
1029    public static Script<String, JsonObject, Ret0> updateRegistration(String scopeURL)
1030    {
1031        // Exception-Check(s) to ensure that if any parameters which are not declared as
1032        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1033        
1034        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
1035        
1036        final int       webSocketID = 36012000 + counter++;
1037        final boolean[] optionals   = { false, };
1038        
1039        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1040        String requestJSON = WriteJSON.get(
1041            parameterTypes.get("updateRegistration"),
1042            parameterNames.get("updateRegistration"),
1043            optionals, webSocketID,
1044            "ServiceWorker.updateRegistration",
1045            scopeURL
1046        );
1047        
1048        // This Remote Command does not have a Return-Value.
1049        return new Script<>
1050            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1051    }
1052    
1053}