Proper Way to Include JavaScript from Package

Permalink
I am working on a package for 5.7.0.4 (and newer) that will require a javascript to be loaded on all pages.

I was able to get it to load fine - both by adding to header or footer. HOWEVER... doing so causes problems:

- If added to header, it loads BEFORE the core scripts, such as main jquery library
- If added to footer, script works BUT deleting blocks from page is not applied upon publishing (the script is initiated via custom templates).

Basically, I figure that the javascript MUST be loaded in the header, but after the jquery library.

The javascript is located at: "/my-package/js/". Below is the code I have in my package controller:
public function on_start() {
   $html = Core::make('helper/html');
   $v = View::getInstance();
   $v->addHeaderItem($html->javascript('jquery.script.js', 'package_name'));
}

PineCreativeLabs