Completed
Pull Request — master (#1653)
by Aristeides
05:10 queued 03:03
created

modules/post-meta/customize-preview.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 18
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 1
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 4
mnd 1
bc 4
fnc 3
bpm 1.3333
cpm 1.3333
noi 1
1
/* global wp, _customizePostPreviewedQueriedObject */
2
jQuery( document ).ready( function() {
3
4
	var self;
0 ignored issues
show
Coding Style introduced by
As per coding-style, prefer block-scoped variables using let or const which have better semantics than var.

Since ECMAScript 6, you can create block-scoped vars or constants with the keywords let or const. These variables/constants are only valid in the code block where they have been declared.

Consider the following two pieces of code:

if (true)
 {
    var x = "Hello, Stonehenge!";
}

console.log(x); //prints Hello, Stonehenge! to the console

and

if (true)
 {
    let x = "Hello, Stonehenge!";
}

console.log(x); //ReferenceError: x is not defined

The variable is not defined otuside of its block. This limits bleeding of variables into other contexts.

To know more about this ECMA6 feature, look at the MDN pages on let and const.

Loading history...
5
6
	self = {
7
		queriedPost: null
8
	};
9
	if ( ! _.isUndefined( _customizePostPreviewedQueriedObject ) ) {
10
		self.queriedPost = _customizePostPreviewedQueriedObject;
11
	}
12
13
	// Send the queried post object to the Customizer pane when ready.
14
	wp.customize.bind( 'preview-ready', function() {
15
		wp.customize.preview.bind( 'active', function() {
16
			wp.customize.preview.send( 'queried-post', self.queriedPost );
17
		} );
18
	} );
19
} );
20