I am developing a theme as well as a few plugins that go along with it. I'm having trouble figuring out dependencies of enqueued files between a theme and a function. If I enqueue a custom .js file in my theme, and then make that file as a dependency of a file I enqueue in my plugin, should I expect the functions from the theme .js file to work in the plugin .js file?
In theme functions.php:
wp_register_script( 'theme-script', 'path/to/theme/script.js', array('jquery')); wp_enqueue_script( 'theme-script');
In plugin my-plugin-name.php:
wp_enqueue_script( 'plugin-script', 'path/to/plugin/script.js', array('theme-script'));
Is this the way I should do this in order to use functions from the theme .js file in my plugin?