Is Active Widget

Input for Register Sidebar

function.php

function eye_widgets_init() {
  register_sidebar( array(
    'name' => __( 'Sidebar', 'eye-theme' ),
    'id' => 'sidebar-widget',
    'description' => __( 'Add widgets here to appear in your sidebar.', 'eye-theme' ),
    'before_widget' => false,
    'after_widget' => false,
    'before_title' => false,
    'after_title' => false,
  ) );
}
/** Register sidebars by running eye_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'eye_widgets_init' );

Output for Register Sidebar

sidebar.php

if(is_active_sidebar('sidebar-widget')): dynamic_sidebar('sidebar-widget'); endif;

Only load a script when the widget is active

if ( is_active_widget( false, false, $this->id_base, true ) ) {
	wp_enqueue_script( 'jquery' );
}