1
1
/**
2
2
* @license
3
- * Copyright 2017 Google Inc.
3
+ * Copyright 2017 Google LLC
4
4
*
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
19
19
* @fileoverview Utilities for Auth test app features.
20
20
*/
21
21
22
-
23
22
/**
24
23
* Initializes the widget for toggling reCAPTCHA size.
25
24
* @param {function(string):void } callback The callback to call when the
@@ -34,21 +33,25 @@ function initRecaptchaToggle(callback) {
34
33
// Set currently selected option.
35
34
$ ( this ) . addClass ( 'active' ) ;
36
35
// Get the current reCAPTCHA setting label.
37
- var size = $ ( e . target ) . text ( ) . toLowerCase ( ) ;
36
+ var size = $ ( e . target )
37
+ . text ( )
38
+ . toLowerCase ( ) ;
38
39
callback ( size ) ;
39
40
} ) ;
40
41
}
41
42
42
43
// Install servicerWorker if supported.
43
44
if ( 'serviceWorker' in navigator ) {
44
- navigator . serviceWorker . register ( '/service-worker.js' , { scope : '/' } )
45
- . then ( function ( reg ) {
46
- // Registration worked.
47
- console . log ( 'Registration succeeded. Scope is ' + reg . scope ) ;
48
- } ) . catch ( function ( error ) {
49
- // Registration failed.
50
- console . log ( 'Registration failed with ' + error . message ) ;
51
- } ) ;
45
+ navigator . serviceWorker
46
+ . register ( '/service-worker.js' , { scope : '/' } )
47
+ . then ( function ( reg ) {
48
+ // Registration worked.
49
+ console . log ( 'Registration succeeded. Scope is ' + reg . scope ) ;
50
+ } )
51
+ . catch ( function ( error ) {
52
+ // Registration failed.
53
+ console . log ( 'Registration failed with ' + error . message ) ;
54
+ } ) ;
52
55
}
53
56
54
57
var webWorker = null ;
@@ -59,11 +62,12 @@ if (window.Worker) {
59
62
* @param {!Object } e The message event received.
60
63
*/
61
64
webWorker . onmessage = function ( e ) {
62
- console . log ( 'User data passed through web worker: ' , e . data ) ;
65
+ console . log ( 'User data passed through web worker: ' , e . data ) ;
63
66
switch ( e . data . type ) {
64
67
case 'GET_USER_INFO' :
65
68
alertSuccess (
66
- 'User data passed through web worker: ' + JSON . stringify ( e . data ) ) ;
69
+ 'User data passed through web worker: ' + JSON . stringify ( e . data )
70
+ ) ;
67
71
break ;
68
72
case 'RUN_TESTS' :
69
73
if ( e . data . status == 'success' ) {
@@ -84,7 +88,7 @@ if (window.Worker) {
84
88
*/
85
89
function onGetCurrentUserDataFromWebWorker ( ) {
86
90
if ( webWorker ) {
87
- webWorker . postMessage ( { type : 'GET_USER_INFO' } ) ;
91
+ webWorker . postMessage ( { type : 'GET_USER_INFO' } ) ;
88
92
} else {
89
93
alertError ( 'Error: Web workers are not supported in the current browser!' ) ;
90
94
}
0 commit comments