textbrowser 0.47.0 → 0.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,14 +15,15 @@ const getDataForSerializingParamsAsURL = () => ({
15
15
  });
16
16
 
17
17
  export default {
18
- bdo: ({fallbackDirection, message}) =>
19
- // Displaying as div with inline display instead of span since
20
- // Firefox puts punctuation at left otherwise (bdo dir
21
- // seemed to have issues in Firefox)
22
- ['div', {style: 'display: inline; direction: ' + fallbackDirection}, [message]],
18
+ bdo ({fallbackDirection, message}) {
19
+ // Displaying as div with inline display instead of span since
20
+ // Firefox puts punctuation at left otherwise (bdo dir
21
+ // seemed to have issues in Firefox)
22
+ return ['div', {style: 'display: inline; direction: ' + fallbackDirection}, [message]];
23
+ },
23
24
  columnsTable: ({
24
25
  lDirectional, fieldInfo, $p, lElement, lIndexedParam, l,
25
- metadataObj, preferredLocale, schemaItems,
26
+ // metadataObj, preferredLocale, schemaItems,
26
27
  fieldMatchesLocale
27
28
  }) => ['table', {
28
29
  border: '1', cellpadding: '5', align: 'center'
@@ -71,19 +72,21 @@ export default {
71
72
  })
72
73
  ]),
73
74
  lElement('check-sequence', 'td', 'title', {}, [
74
- ['select', {name: lIndexedParam('field') + idx, id: fieldIndex, size: '1'},
75
- fieldInfo.map(({field, fieldAliasOrName}, j) => {
76
- const matchedFieldParam = fieldParam && fieldParam === fieldAliasOrName;
77
- return ['option', {
78
- dataset: {name: field},
79
- value: fieldAliasOrName,
80
- selected: (
81
- matchedFieldParam ||
82
- (j === i && !$p.has(fieldIndex))
83
- )
84
- }, [fieldAliasOrName]];
85
- })
86
- ]
75
+ ['select', {
76
+ name: lIndexedParam('field') + idx,
77
+ id: fieldIndex,
78
+ size: '1'
79
+ }, fieldInfo.map(({field, fieldAliasOrName}, j) => {
80
+ const matchedFieldParam = fieldParam && fieldParam === fieldAliasOrName;
81
+ return ['option', {
82
+ dataset: {name: field},
83
+ value: fieldAliasOrName,
84
+ selected: (
85
+ matchedFieldParam ||
86
+ (j === i && !$p.has(fieldIndex))
87
+ )
88
+ }, [fieldAliasOrName]];
89
+ })]
87
90
  ]),
88
91
  ['td', [ // Todo: Make as tag selector with fields as options
89
92
  lElement('interlinear-tips', 'input', 'title', {
@@ -128,7 +131,7 @@ export default {
128
131
  type: 'button',
129
132
  $on: {
130
133
  click () {
131
- fieldInfo.forEach(({field}, i) => {
134
+ fieldInfo.forEach((/* {field} */_, i) => {
132
135
  const idx = i + 1;
133
136
  // The following is redundant with 'field' but may need to
134
137
  // retrieve later out of order?
@@ -278,22 +281,20 @@ export default {
278
281
  dir: 'ltr'
279
282
  }, [
280
283
  lDirectional('font_stretch'), nbsp,
281
- ['select', {name: lParam('fontstretch')},
282
- [
283
- 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed',
284
- 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'
285
- ].map((stretch) => {
286
- const atts = {
287
- value: lDirectional(['param_values', 'font-stretch', stretch]),
288
- selected: null
289
- };
290
- if ($p.get('fontstretch') === stretch ||
291
- (!$p.has('fontstretch') && stretch === 'normal')) {
292
- atts.selected = 'selected';
293
- }
294
- return ['option', atts, [lDirectional(['param_values', 'font-stretch', stretch])]];
295
- })
296
- ]
284
+ ['select', {name: lParam('fontstretch')}, [
285
+ 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed',
286
+ 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'
287
+ ].map((stretch) => {
288
+ const atts = {
289
+ value: lDirectional(['param_values', 'font-stretch', stretch]),
290
+ selected: null
291
+ };
292
+ if ($p.get('fontstretch') === stretch ||
293
+ (!$p.has('fontstretch') && stretch === 'normal')) {
294
+ atts.selected = 'selected';
295
+ }
296
+ return ['option', atts, [lDirectional(['param_values', 'font-stretch', stretch])]];
297
+ })]
297
298
  ]],
298
299
  /**/
299
300
  ['br'], ['br'],
@@ -326,8 +327,8 @@ export default {
326
327
  ['yes', lDirectional(['param_values', 'y'])],
327
328
  ['no', lDirectional(['param_values', 'n'])],
328
329
  ['none', lDirectional(['param_values', '0'])]
329
- ].map(([key, val], i, arr) =>
330
- ['label', [
330
+ ].map(([key, val], i, arr) => {
331
+ return ['label', [
331
332
  ['input', {
332
333
  name: lParam('header'),
333
334
  type: 'radio',
@@ -336,8 +337,8 @@ export default {
336
337
  (!$p.has('header') && i === 1)
337
338
  }],
338
339
  lDirectional(key), (i === arr.length - 1 ? '' : nbsp3)
339
- ]]
340
- ))
340
+ ]];
341
+ }))
341
342
  ]],
342
343
  ['div', [
343
344
  lDirectional('footer_wstyles'), nbsp2,
@@ -345,8 +346,8 @@ export default {
345
346
  ['yes', lDirectional(['param_values', 'y'])],
346
347
  ['no', lDirectional(['param_values', 'n'])],
347
348
  ['none', lDirectional(['param_values', '0'])]
348
- ].map(([key, val], i, arr) =>
349
- ['label', [
349
+ ].map(([key, val], i, arr) => {
350
+ return ['label', [
350
351
  ['input', {
351
352
  name: lParam('footer'),
352
353
  type: 'radio',
@@ -355,8 +356,8 @@ export default {
355
356
  (!$p.has('footer') && i === 2)
356
357
  }],
357
358
  lDirectional(key), (i === arr.length - 1 ? '' : nbsp3)
358
- ]]
359
- ))
359
+ ]];
360
+ }))
360
361
  ]],
361
362
  ['label', [
362
363
  ['input', {
@@ -374,8 +375,8 @@ export default {
374
375
  ['yes', lDirectional(['param_values', 'y'])],
375
376
  ['no', lDirectional(['param_values', 'n'])],
376
377
  ['none', lDirectional(['param_values', '0'])]
377
- ].map(([key, val], i, arr) =>
378
- ['label', [
378
+ ].map(([key, val], i, arr) => {
379
+ return ['label', [
379
380
  ['input', {
380
381
  name: lParam('caption'),
381
382
  type: 'radio',
@@ -384,8 +385,8 @@ export default {
384
385
  (!$p.has('caption') && i === 2)
385
386
  }],
386
387
  lDirectional(key), (i === arr.length - 1 ? '' : nbsp3)
387
- ]]
388
- ))
388
+ ]];
389
+ }))
389
390
  ]],
390
391
  ['br'],
391
392
  ['div', [
@@ -512,7 +513,9 @@ export default {
512
513
  lParam, lDirectional, l, lElement, $p, serializeParamsAsURL, content
513
514
  }) {
514
515
  const addRowContent = (rowContent) => {
515
- if (!rowContent || !rowContent.length) { return; }
516
+ if (!rowContent || !rowContent.length) {
517
+ return;
518
+ }
516
519
  content.push(['tr', rowContent]);
517
520
  };
518
521
  [
@@ -562,10 +565,11 @@ export default {
562
565
  ].forEach(addRowContent);
563
566
  },
564
567
  getPreferences: ({
565
- languageParam, workI18n, paramsSetter, replaceHash,
568
+ // languageParam, workI18n, groups,
569
+ paramsSetter, replaceHash,
566
570
  getFieldAliasOrNames, work,
567
571
  langs, languageI18n, l, localizeParamNames, namespace,
568
- hideFormattingSection, groups, preferencesPlugin
572
+ hideFormattingSection, preferencesPlugin
569
573
  }) => ['div', {
570
574
  style: {textAlign: 'left'}, id: 'preferences', hidden: 'true'
571
575
  }, [
@@ -611,9 +615,9 @@ export default {
611
615
  change ({target: {selectedOptions}}) {
612
616
  // Todo: EU disclaimer re: storage?
613
617
  localStorage.setItem(namespace + '-langCodes', JSON.stringify(
614
- [...selectedOptions].map((opt) =>
615
- opt.value
616
- )
618
+ [...selectedOptions].map((opt) => {
619
+ return opt.value;
620
+ })
617
621
  ));
618
622
  }
619
623
  }
@@ -632,15 +636,20 @@ export default {
632
636
  ]];
633
637
  })]
634
638
  ]],
635
- (preferencesPlugin ? preferencesPlugin({
636
- $, l, jml, paramsSetter, getDataForSerializingParamsAsURL, work,
637
- replaceHash, getFieldAliasOrNames
638
- }) : '')
639
+ (preferencesPlugin
640
+ ? preferencesPlugin({
641
+ $, l, jml, paramsSetter, getDataForSerializingParamsAsURL, work,
642
+ replaceHash, getFieldAliasOrNames
643
+ })
644
+ : ''
645
+ )
639
646
  ]],
640
647
  addBrowseFields ({browseFields, fieldInfo, lDirectional, i, lIndexedParam, $p, content}) {
641
648
  const work = $p.get('work');
642
649
  const addRowContent = (rowContent) => {
643
- if (!rowContent || !rowContent.length) { return; }
650
+ if (!rowContent || !rowContent.length) {
651
+ return;
652
+ }
644
653
  content.push(['tr', rowContent]);
645
654
  };
646
655
  [
@@ -652,8 +661,8 @@ export default {
652
661
  : '',
653
662
  [
654
663
  ...(() => {
655
- const addBrowseFieldSet = (setType) =>
656
- browseFields.reduce((rowContent, {
664
+ const addBrowseFieldSet = (setType) => {
665
+ return browseFields.reduce((rowContent, {
657
666
  fieldName, aliases, fieldSchema: {minimum, maximum}
658
667
  }, j) => {
659
668
  // Namespace by work for sake of browser auto-complete caching
@@ -664,36 +673,41 @@ export default {
664
673
  ['label', {for: name}, [fieldName]]
665
674
  ]],
666
675
  ['td', [
667
- aliases ? ['datalist', {id: 'dl-' + id},
668
- aliases.map((alias) => ['option', [alias]])
669
- ] : '',
670
- aliases ? ['input', {
671
- name, id, class: 'browseField',
672
- list: 'dl-' + id,
673
- value: $p.get(name, true),
674
- $on: setType === 'start'
675
- ? {change (e) {
676
- $$('input.browseField').forEach((bf) => {
677
- if (bf.id.includes((i + 1) + '-' +
678
- (j + 1))
679
- ) {
680
- bf.value = e.target.value;
681
- }
682
- });
683
- }}
684
- : undefined
685
- }] : ['input', {
686
- name, id,
687
- type: 'number',
688
- min: minimum,
689
- max: maximum,
690
- value: $p.get(name, true)
691
- }],
676
+ aliases
677
+ ? ['datalist', {
678
+ id: 'dl-' + id
679
+ }, aliases.map((alias) => ['option', [alias]])]
680
+ : '',
681
+ aliases
682
+ ? ['input', {
683
+ name, id, class: 'browseField',
684
+ list: 'dl-' + id,
685
+ value: $p.get(name, true),
686
+ $on: setType === 'start'
687
+ ? {change (e) {
688
+ $$('input.browseField').forEach((bf) => {
689
+ if (bf.id.includes((i + 1) + '-' +
690
+ (j + 1))
691
+ ) {
692
+ bf.value = e.target.value;
693
+ }
694
+ });
695
+ }}
696
+ : undefined
697
+ }]
698
+ : ['input', {
699
+ name, id,
700
+ type: 'number',
701
+ min: minimum,
702
+ max: maximum,
703
+ value: $p.get(name, true)
704
+ }],
692
705
  nbsp3
693
706
  ]]
694
707
  );
695
708
  return rowContent;
696
709
  }, {'#': []});
710
+ };
697
711
  return [
698
712
  addBrowseFieldSet('start'),
699
713
  ['td', [
@@ -708,7 +722,7 @@ export default {
708
722
  ]]
709
723
  ],
710
724
  [
711
- ['td', {colspan: 4 * browseFields.length + 2 + 1, align: 'center'}, [
725
+ ['td', {colspan: (4 * browseFields.length) + 2 + 1, align: 'center'}, [
712
726
  ['table', [
713
727
  ['tr', [
714
728
  browseFields.reduce((
@@ -724,9 +738,11 @@ export default {
724
738
  ['label', {for: name}, [fieldName]]
725
739
  ]],
726
740
  ['td', [
727
- aliases ? ['datalist', {id: 'dl-' + id},
728
- aliases.map((alias) => ['option', [alias]])
729
- ] : '',
741
+ aliases
742
+ ? ['datalist', {
743
+ id: 'dl-' + id
744
+ }, aliases.map((alias) => ['option', [alias]])]
745
+ : '',
730
746
  aliases
731
747
  ? ['input', {
732
748
  name, id, class: 'browseField',
@@ -752,15 +768,16 @@ export default {
752
768
  ['td', [
753
769
  ['label', [
754
770
  lDirectional('field') + nbsp2,
755
- ['select', {name: lIndexedParam('anchorfield') + (i + 1), size: '1'},
756
- fieldInfo.map(({fieldAliasOrName}) => {
757
- const val = $p.get(lIndexedParam('anchorfield') + (i + 1), true);
758
- if (val === fieldAliasOrName) {
759
- return ['option', {selected: true}, [fieldAliasOrName]];
760
- }
761
- return ['option', [fieldAliasOrName]];
762
- })
763
- ]
771
+ ['select', {
772
+ name: lIndexedParam('anchorfield') + (i + 1),
773
+ size: '1'
774
+ }, fieldInfo.map(({fieldAliasOrName}) => {
775
+ const val = $p.get(lIndexedParam('anchorfield') + (i + 1), true);
776
+ if (val === fieldAliasOrName) {
777
+ return ['option', {selected: true}, [fieldAliasOrName]];
778
+ }
779
+ return ['option', [fieldAliasOrName]];
780
+ })]
764
781
  ]]
765
782
  ]]
766
783
  ]]
@@ -771,7 +788,8 @@ export default {
771
788
  },
772
789
  main ({
773
790
  workI18n, languageParam,
774
- l, namespace, heading, fallbackDirection, languageI18n, langs, fieldInfo, localizeParamNames,
791
+ l, namespace, heading, // fallbackDirection,
792
+ languageI18n, langs, fieldInfo, localizeParamNames,
775
793
  serializeParamsAsURL, paramsSetter, replaceHash,
776
794
  getFieldAliasOrNames,
777
795
  hideFormattingSection, $p,
@@ -784,9 +802,10 @@ export default {
784
802
  {...getDataForSerializingParamsAsURL(), type}
785
803
  );
786
804
  };
787
- const lOption = (key, atts) =>
788
- ['option', atts, [
789
- l(key
805
+ const lOption = (key, atts) => {
806
+ return ['option', atts, [
807
+ l(
808
+ key
790
809
  // Ensure `intl-dom` supports
791
810
  // , fallback ({message}) {
792
811
  // atts.dir = fallbackDirection;
@@ -794,6 +813,7 @@ export default {
794
813
  // }
795
814
  )
796
815
  ]];
816
+ };
797
817
  // Returns element with localized or fallback attribute value (as Jamilih);
798
818
  // also adds direction
799
819
  jml(
@@ -38,11 +38,11 @@ export default ({groups, workI18n, getNextAlias, $p, followParams}) => {
38
38
  }
39
39
  }, [
40
40
  ['option', {value: ''}, ['--']],
41
- ...group.files.map(({name: fileName}) =>
42
- ['option', {
41
+ ...group.files.map(({name: fileName}) => {
42
+ return ['option', {
43
43
  value: workI18n(['workNames', group.id, fileName])
44
- }, [getNextAlias()]]
45
- )
44
+ }, [getNextAlias()]];
45
+ })
46
46
  ]]
47
47
  // Todo: Add in Go button (with 'submitgo' localization string) to
48
48
  // avoid need for pull-down if using first selection?
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @file Note that this should be kept as a polyglot client-server file.
3
+ */
1
4
  /**
2
5
  *
3
6
  * @param {string} param
@@ -11,7 +14,7 @@ function _prepareParam (param, skip) {
11
14
  }
12
15
 
13
16
  // start, end, toggle
14
- const endNums = /\d+(-\d+)?$/; // eslint-disable-line unicorn/no-unsafe-regex
17
+ const endNums = /\d+(-\d+)?$/;
15
18
  const indexed = param.match(endNums);
16
19
  if (indexed) {
17
20
  // Todo: We could i18nize numbers as well
@@ -20,6 +20,9 @@ export const getPreferredLanguages = ({namespace, preferredLocale}) => {
20
20
  return langArr;
21
21
  };
22
22
 
23
+ /**
24
+ * @classdesc Note that this should be kept as a polyglot client-server class.
25
+ */
23
26
  export class Languages {
24
27
  constructor ({langData}) {
25
28
  this.langData = langData;
@@ -33,7 +36,9 @@ export class Languages {
33
36
  // || new Intl.DisplayNames([locale], {type: 'language'}).of(code);
34
37
  }
35
38
  getFieldNameFromPluginNameAndLocales ({
36
- pluginName, locales, workI18n, targetLanguage, applicableFieldI18N, meta, metaApplicableField
39
+ pluginName,
40
+ // locales,
41
+ workI18n, targetLanguage, applicableFieldI18N, meta, metaApplicableField
37
42
  }) {
38
43
  return workI18n(['plugins', pluginName, 'fieldname'], {
39
44
  ...meta,
@@ -3,8 +3,9 @@ import {getPreferredLanguages} from './Languages.js';
3
3
  // Keep this as the last import for Rollup
4
4
  import JsonRefs from 'json-refs'; // eslint-disable-line import/order
5
5
 
6
- const getCurrDir = () =>
7
- window.location.href.replace(/(index\.html)?#.*$/, '');
6
+ const getCurrDir = () => {
7
+ return window.location.href.replace(/(index\.html)?#.*$/, '');
8
+ };
8
9
 
9
10
  export const getMetaProp = function getMetaProp (lang, metadataObj, properties, allowObjects) {
10
11
  let prop;
@@ -38,8 +39,8 @@ export const getMetadata = async (file, property, basePath) => {
38
39
  url.pathname = file;
39
40
  url.hash = property ? '#/' + property : '';
40
41
 
41
- return (await JsonRefs
42
- .resolveRefsAt(
42
+ return (await JsonRefs.
43
+ resolveRefsAt(
43
44
  url.toString(),
44
45
  {
45
46
  loaderOptions: {
@@ -59,9 +60,9 @@ export const getMetadata = async (file, property, basePath) => {
59
60
  export const getFieldNameAndValueAliases = function ({
60
61
  field, schemaItems, metadataObj, getFieldAliasOrName, lang
61
62
  }) {
62
- const fieldSchemaIndex = schemaItems.findIndex((item) =>
63
- item.title === field
64
- );
63
+ const fieldSchemaIndex = schemaItems.findIndex((item) => {
64
+ return item.title === field;
65
+ });
65
66
  const fieldSchema = schemaItems[fieldSchemaIndex];
66
67
 
67
68
  const fieldInfo = metadataObj.fields[field];
@@ -118,13 +119,13 @@ export const getFieldNameAndValueAliases = function ({
118
119
  // We'll assume the longest version is best for auto-complete
119
120
  ret.aliases.push(
120
121
  ...(
121
- aliases.filter((v) =>
122
- aliases.every((x) =>
123
- x === v || !(
122
+ aliases.filter((v) => {
123
+ return aliases.every((x) => {
124
+ return x === v || !(
124
125
  x.toLowerCase().startsWith(v.toLowerCase())
125
- )
126
- )
127
- ).map((v) => v + ' (' + key + ')') // Todo: i18nize
126
+ );
127
+ });
128
+ }).map((v) => v + ' (' + key + ')') // Todo: i18nize
128
129
  )
129
130
  );
130
131
  });
@@ -152,13 +153,13 @@ export const getBrowseFieldData = function ({
152
153
  // Todo: Deal with ['td', [['h3', [lDirectional(browseFieldObject.name)]]]]
153
154
  // as kind of fieldset
154
155
 
155
- const browseFields = fieldSets.map((field) =>
156
- getFieldNameAndValueAliases({
156
+ const browseFields = fieldSets.map((field) => {
157
+ return getFieldNameAndValueAliases({
157
158
  lang,
158
159
  field, schemaItems, metadataObj,
159
160
  getFieldAliasOrName
160
- })
161
- );
161
+ });
162
+ });
162
163
  callback({setName, browseFields, i, presort}); // eslint-disable-line n/no-callback-literal
163
164
  });
164
165
  };
@@ -199,7 +200,7 @@ export class Metadata {
199
200
  // If this is a localized field (e.g., enum), we don't want
200
201
  // to avoid as may be translated (should check though)
201
202
  const hasFieldValue = localeStrings &&
202
- Object.keys(localeStrings).some(lng => {
203
+ Object.keys(localeStrings).some((lng) => {
203
204
  const fv = localeStrings[lng] &&
204
205
  localeStrings[lng].fieldvalue;
205
206
  return fv && fv[field];
@@ -207,9 +208,9 @@ export class Metadata {
207
208
 
208
209
  return hasFieldValue ||
209
210
  (metaLang && preferredLanguages.includes(metaLang)) ||
210
- schemaItems.some(item =>
211
- item.title === field && item.type !== 'string'
212
- );
211
+ schemaItems.some((item) => {
212
+ return item.title === field && item.type !== 'string';
213
+ });
213
214
  };
214
215
  }
215
216
  }
@@ -1,20 +1,20 @@
1
1
  export const escapePluginComponent = (pluginName) => {
2
- return pluginName.replace(/\^/g, '^^') // Escape our escape
3
- .replace(/-/g, '^0');
2
+ return pluginName.replaceAll('^', '^^'). // Escape our escape
3
+ replaceAll('-', '^0');
4
4
  };
5
5
 
6
6
  export const unescapePluginComponent = (pluginName) => {
7
7
  if (!pluginName) {
8
8
  return pluginName;
9
9
  }
10
- return pluginName.replace(
10
+ return pluginName.replaceAll(
11
11
  /(\^+)0/g,
12
12
  (n0, esc) => {
13
13
  return esc.length % 2
14
14
  ? esc.slice(1) + '-'
15
15
  : n0;
16
16
  }
17
- ).replace(/\^\^/g, '^');
17
+ ).replaceAll('^^', '^');
18
18
  };
19
19
 
20
20
  export const escapePlugin = ({pluginName, applicableField, targetLanguage}) => {
@@ -1,13 +1,23 @@
1
- /* globals console, location, URL */
2
1
  // import {escapeHTML} from './sanitize.js';
3
2
  import {dialogs} from './dialogs.js';
4
3
 
4
+ /**
5
+ * Note that this function be kept as a polyglot client-server file.
6
+ * @param {PlainObject} target
7
+ * @param {PlainObject} source
8
+ * @returns {{
9
+ * userJSON: string,
10
+ * languages: string,
11
+ * serviceWorkerPath: string,
12
+ * files: string,
13
+ * namespace: string
14
+ * }}
15
+ */
5
16
  export const setServiceWorkerDefaults = (target, source) => {
6
17
  target.userJSON = source.userJSON || 'resources/user.json';
7
18
  target.languages = source.languages || new URL(
8
- '../appdata/languages.json',
9
- // Todo: Substitute with `import.meta.url`
10
- new URL('node_modules/textbrowser/resources/index.js', location)
19
+ '../../appdata/languages.json',
20
+ import.meta.url
11
21
  ).href;
12
22
  target.serviceWorkerPath = source.serviceWorkerPath ||
13
23
  `sw.js?pathToUserJSON=${
@@ -25,7 +35,8 @@ export const setServiceWorkerDefaults = (target, source) => {
25
35
  // some tabs open)
26
36
 
27
37
  export const listenForWorkerUpdate = ({
28
- r, logger
38
+ r
39
+ // logger
29
40
  }) => {
30
41
  r.addEventListener('updatefound', (e) => {
31
42
  // New service worker has appeared
@@ -53,8 +64,7 @@ this dialog now and continue working with the old version.
53
64
  However, when you are finished, you should close this tab
54
65
  and any other old tabs for this site in order to be able to
55
66
  begin using the new version.
56
- `
57
- );
67
+ `);
58
68
  break;
59
69
  case 'redundant': // discarded. Either failed install, or it's been
60
70
  // replaced by a newer version
@@ -71,8 +81,7 @@ this dialog now and continue working with the old version.
71
81
  However, when you are finished, you may wish to close this tab
72
82
  and any other old tabs for this site in order to try again
73
83
  for offline installation.
74
- `
75
- );
84
+ `);
76
85
  break;
77
86
  // These shouldn't occur as we are not skipping waiting (?)
78
87
  case 'activating':
@@ -94,7 +103,7 @@ export const respondToState = async ({
94
103
  // We use this promise for rejecting (inside a listener)
95
104
  // to a common catch and to prevent continuation by
96
105
  // failing to return
97
- return new Promise(async (resolve, reject) => { // eslint-disable-line no-async-promise-executor
106
+ return new Promise(async () => { // eslint-disable-line no-async-promise-executor
98
107
  navigator.serviceWorker.addEventListener('message', ({data}) => {
99
108
  const {message, type, name, errorType} = data;
100
109
  console.log('msg1', message, r);
@@ -175,8 +184,7 @@ export const respondToState = async ({
175
184
  await dialogs.alert(`
176
185
  There was likely an error installing. Click "ok" to try again.
177
186
  (Error code: Service worker is redundant)
178
- `
179
- );
187
+ `);
180
188
  location.reload();
181
189
  // listenForWorkerUpdate({r, logger});
182
190
  } else if (r.installing) {
@@ -192,8 +200,7 @@ you have in them, please close this and any other existing tabs
192
200
  running this web application and then open the site again.
193
201
  Please note it may take some time to install and may not show
194
202
  any indication it is installing.
195
- `, {ok: false}
196
- );
203
+ `, {ok: false});
197
204
  // We might just let the user go on without a reload, but
198
205
  // as fetch operations would apparently wait to execute,
199
206
  // it wouldn't be much use, so just reload (to get same