File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,10 @@ const loadedElementContentRects = new Map();
32
32
* @type {InitializeCallback }
33
33
* @param {InitializeArgs } args Args.
34
34
*/
35
- export async function initialize ( { log } ) {
35
+ export async function initialize ( { log : _log } ) {
36
+ // eslint-disable-next-line no-console
37
+ const log = _log || console . log ; // TODO: Remove once Optimization Detective likely updated, or when strict version requirement added in od_init action.
38
+
36
39
/** @type NodeListOf<HTMLDivElement> */
37
40
const embedWrappers = document . querySelectorAll (
38
41
'.wp-block-embed > .wp-block-embed__wrapper[data-od-xpath]'
@@ -52,11 +55,17 @@ export async function initialize( { log } ) {
52
55
* @param {FinalizeArgs } args Args.
53
56
*/
54
57
export async function finalize ( {
55
- log,
56
- error,
58
+ log : _log ,
59
+ error : _error ,
57
60
getElementData,
58
61
extendElementData,
59
62
} ) {
63
+ /* eslint-disable no-console */
64
+ // TODO: Remove once Optimization Detective likely updated, or when strict version requirement added in od_init action.
65
+ const log = _log || console . log ;
66
+ const error = _error || console . error ;
67
+ /* eslint-enable no-console */
68
+
60
69
for ( const [ xpath , domRect ] of loadedElementContentRects . entries ( ) ) {
61
70
try {
62
71
extendElementData ( xpath , {
Original file line number Diff line number Diff line change @@ -40,7 +40,10 @@ const externalBackgroundImages = [];
40
40
* @type {InitializeCallback }
41
41
* @param {InitializeArgs } args Args.
42
42
*/
43
- export async function initialize ( { log, onLCP } ) {
43
+ export async function initialize ( { log : _log , onLCP } ) {
44
+ // eslint-disable-next-line no-console
45
+ const log = _log || console . log ; // TODO: Remove once Optimization Detective likely updated, or when strict version requirement added in od_init action.
46
+
44
47
onLCP (
45
48
( metric ) => {
46
49
handleLCPMetric ( metric , log ) ;
@@ -137,7 +140,10 @@ function handleLCPMetric( metric, log ) {
137
140
* @type {FinalizeCallback }
138
141
* @param {FinalizeArgs } args Args.
139
142
*/
140
- export async function finalize ( { extendRootData, log } ) {
143
+ export async function finalize ( { extendRootData, log : _log } ) {
144
+ // eslint-disable-next-line no-console
145
+ const log = _log || console . log ; // TODO: Remove once Optimization Detective likely updated, or when strict version requirement added in od_init action.
146
+
141
147
if ( externalBackgroundImages . length === 0 ) {
142
148
return ;
143
149
}
You can’t perform that action at this time.
0 commit comments