Changeset 42038
- Timestamp:
- 10/29/2017 03:07:30 AM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/js/customize-controls.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r42037 r42038 349 349 * @see PHP class WP_Customize_Setting. 350 350 * 351 * @since 3.4.0 351 352 * @class 352 353 * @augments wp.customize.Value 353 354 * @augments wp.customize.Class 354 *355 * @param {object} id The Setting ID.356 * @param {object} value The initial value of the setting.357 * @param {object} options.previewer The Previewer instance to sync with.358 * @param {object} options.transport The transport to use for previewing. Supports 'refresh' and 'postMessage'.359 * @param {object} options.dirty360 355 */ 361 356 api.Setting = api.Value.extend({ 357 358 /** 359 * Default params. 360 * 361 * @since 4.9.0 362 * @var {object} 363 */ 364 defaults: { 365 transport: 'refresh', 366 dirty: false 367 }, 368 369 /** 370 * Initialize. 371 * 372 * @since 3.4.0 373 * 374 * @param {string} id - The setting ID. 375 * @param {*} value - The initial value of the setting. 376 * @param {object} [options={}] - Options. 377 * @param {string} [options.transport=refresh] - The transport to use for previewing. Supports 'refresh' and 'postMessage'. 378 * @param {boolean} [options.dirty=false] - Whether the setting should be considered initially dirty. 379 * @param {object} [options.previewer] - The Previewer instance to sync with. Defaults to wp.customize.previewer. 380 */ 362 381 initialize: function( id, value, options ) { 363 var setting = this; 364 api.Value.prototype.initialize.call( setting, value, options ); 382 var setting = this, params; 383 params = _.extend( 384 { previewer: api.previewer }, 385 setting.defaults, 386 options || {} 387 ); 388 389 api.Value.prototype.initialize.call( setting, value, params ); 365 390 366 391 setting.id = id; 367 setting.transport = setting.transport || 'refresh'; 368 setting._dirty = options.dirty || false; 392 setting._dirty = params.dirty; // The _dirty property is what the Customizer reads from. 369 393 setting.notifications = new api.Notifications(); 370 394
Note: See TracChangeset
for help on using the changeset viewer.