Skip to content

Commit

Permalink
resolves #620
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesros161 committed Oct 4, 2022
1 parent e6cef45 commit bb911fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
21 changes: 5 additions & 16 deletions src/assets/js/customizer/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,13 @@
* @param $
*/
( function( $ ) {
var refreshEvent = $.Event( 'boldgrid_customizer_refresh' ),
$body = $( 'body' ),
$themeControls = $( '#customize-theme-controls' );
$window = $( window );
var refreshEvent = $.Event( 'boldgrid_customizer_refresh' ),
$body = $( 'body' ),
$themeControls = $( '#customize-theme-controls' ),
$window = $( window );

$window.on( 'message', function( e ) {
var message,
event = e.originalEvent;

// Ensure we have a string that's JSON.parse-able.
if ( 'string' !== typeof event.data || '{' !== event.data[0] ) {
return;
}

message = JSON.parse( event.data );
if ( 'synced' === message.id ) {
$window.trigger( refreshEvent, message );
}
$window.trigger( refreshEvent, e.originalEvent.data );
} );

// Prevent interaction with panels until Customizer fully loads.
Expand Down
2 changes: 1 addition & 1 deletion src/assets/js/customizer/widget-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BOLDGRID.CUSTOMIZER = BOLDGRID.CUSTOMIZER || {};
self.hover_bound = false;
self.section_click_bound = false;
$( function() {
$window.on( 'boldgrid_customizer_refresh', onload );
$( window ).on( 'boldgrid_customizer_refresh', onload );
} );

onload = function() {
Expand Down

0 comments on commit bb911fc

Please sign in to comment.