1
1
if ( ! window . dash_clientside ) {
2
- window . dash_clientside = { } ;
2
+ window . dash_clientside = { }
3
3
}
4
4
window . dash_clientside . clientside = {
5
- add : function ( a , b ) {
5
+
6
+ add : function ( a , b ) {
6
7
return window . R . add ( a , b ) ;
7
8
} ,
8
9
@@ -16,7 +17,7 @@ window.dash_clientside.clientside = {
16
17
17
18
add1_break_at_11 : function ( value ) {
18
19
if ( parseInt ( value , 10 ) === 11 ) {
19
- throw new Error ( " Unexpected error" ) ;
20
+ throw new Error ( ' Unexpected error' ) ;
20
21
}
21
22
return parseInt ( value , 10 ) + 1 ;
22
23
} ,
@@ -35,71 +36,71 @@ window.dash_clientside.clientside = {
35
36
return [ parseInt ( value2 , 10 ) + 1 , parseInt ( value3 , 10 ) + 1 ] ;
36
37
} ,
37
38
38
- add_to_four_outputs : function ( value ) {
39
+ add_to_four_outputs : function ( value ) {
39
40
return [
40
41
parseInt ( value ) + 1 ,
41
42
parseInt ( value ) + 2 ,
42
43
parseInt ( value ) + 3 ,
43
- parseInt ( value ) + 4 ,
44
- ] ;
44
+ parseInt ( value ) + 4
45
+ ]
45
46
} ,
46
47
47
- side_effect_and_return_a_promise : function ( value ) {
48
- return new Promise ( function ( resolve , reject ) {
49
- setTimeout ( function ( ) {
50
- setTimeout ( function ( ) {
51
- document . getElementById ( "side-effect" ) . innerText =
52
- "side effect" ;
48
+ side_effect_and_return_a_promise : function ( value ) {
49
+ return new Promise ( function ( resolve , reject ) {
50
+ setTimeout ( function ( ) {
51
+ setTimeout ( function ( ) {
52
+ document . getElementById ( 'side-effect' ) . innerText = (
53
+ 'side effect'
54
+ ) ;
53
55
} , 100 ) ;
54
- resolve ( " foo" ) ;
56
+ resolve ( ' foo' ) ;
55
57
} , 1 ) ;
56
58
} ) ;
57
59
} ,
58
60
59
- triggered_to_str : function ( n_clicks0 , n_clicks1 ) {
61
+ triggered_to_str : function ( n_clicks0 , n_clicks1 ) {
60
62
const triggered = dash_clientside . callback_context . triggered ;
61
- return triggered . map ( ( t ) => `${ t . prop_id } = ${ t . value } ` ) . join ( ", " ) ;
63
+ return triggered . map ( t => `${ t . prop_id } = ${ t . value } ` ) . join ( ', ' ) ;
62
64
} ,
63
65
64
- triggered_id_to_str : function ( n_clicks0 , n_clicks1 ) {
66
+ triggered_id_to_str : function ( n_clicks0 , n_clicks1 ) {
65
67
const triggered = dash_clientside . callback_context . triggered_id ;
66
- const triggered_id =
67
- typeof triggered === "string" ? triggered : triggered . btn1 ;
68
- return triggered_id ;
68
+ const triggered_id = typeof triggered === "string" ? triggered : triggered . btn1
69
+ return triggered_id
69
70
} ,
70
71
71
- inputs_to_str : function ( n_clicks0 , n_clicks1 ) {
72
+ inputs_to_str : function ( n_clicks0 , n_clicks1 ) {
72
73
const inputs = dash_clientside . callback_context . inputs ;
73
74
const keys = Object . keys ( inputs ) ;
74
- return keys . map ( ( k ) => `${ k } = ${ inputs [ k ] } ` ) . join ( ", " ) ;
75
+ return keys . map ( k => `${ k } = ${ inputs [ k ] } ` ) . join ( ', ' ) ;
75
76
} ,
76
77
77
- inputs_list_to_str : function ( n_clicks0 , n_clicks1 ) {
78
+ inputs_list_to_str : function ( n_clicks0 , n_clicks1 ) {
78
79
return JSON . stringify ( dash_clientside . callback_context . inputs_list ) ;
79
80
} ,
80
81
81
- states_to_str : function ( val0 , val1 , st0 , st1 ) {
82
+ states_to_str : function ( val0 , val1 , st0 , st1 ) {
82
83
const states = dash_clientside . callback_context . states ;
83
84
const keys = Object . keys ( states ) ;
84
- return keys . map ( ( k ) => `${ k } = ${ states [ k ] } ` ) . join ( ", " ) ;
85
+ return keys . map ( k => `${ k } = ${ states [ k ] } ` ) . join ( ', ' ) ;
85
86
} ,
86
87
87
- states_list_to_str : function ( val0 , val1 , st0 , st1 ) {
88
+ states_list_to_str : function ( val0 , val1 , st0 , st1 ) {
88
89
return JSON . stringify ( dash_clientside . callback_context . states_list ) ;
89
90
} ,
90
91
91
- input_output_callback : function ( inputValue ) {
92
+ input_output_callback : function ( inputValue ) {
92
93
const triggered = dash_clientside . callback_context . triggered ;
93
- if ( triggered . length == 0 ) {
94
+ if ( triggered . length == 0 ) {
94
95
return inputValue ;
95
96
} else {
96
97
return inputValue + 1 ;
97
98
}
98
99
} ,
99
100
100
- input_output_follower : function ( inputValue ) {
101
+ input_output_follower : function ( inputValue ) {
101
102
if ( ! window . callCount ) {
102
- window . callCount = 0 ;
103
+ window . callCount = 0
103
104
}
104
105
window . callCount += 1 ;
105
106
return inputValue . toString ( ) ;
0 commit comments