Surely.
function loadMenuScripts()
{
wp_enqueue_script( 'main', get_template_directory_uri() . 'js/main.js', array( 'jquery' ), '', false );
}
add_action( 'wp_enqueue_scripts', 'loadMenuScripts' );
Additionally, if you need to load it in the footer, go ahead and change the action to:
add_action( 'wp_footer', 'loadMenuScripts' );
Also, it seems as if this is an option for users.
Before enqueueing, check to see if your menu is being used:
if( class_exists( 'mega_menu` ) ) {
add_action( 'wp_footer', 'loadMenuScripts' ); // Or whatever.
}
So you don’t enqueue it if it’s not necessary.
In fact, I’d recommend you create a Class for this functionality and then decide, based on whether or not this Mega Menu is enabled, to enqueue its assets.