dist/hawtio-utilities.js
function unregister(jolokia, scope) {
        if (angular.isDefined(scope.$jhandle)) {
            scope.$jhandle.forEach(function (handle) {
                jolokia.unregister(handle);
            });
            delete scope.$jhandle;
        }
    }
function unregister(jolokia, scope) {
        if (angular.isDefined(scope.$jhandle)) {
            scope.$jhandle.forEach(function (handle) {
                jolokia.unregister(handle);
            });
            delete scope.$jhandle;
        }
    }
function unregister ( jolokia , scope ) { if ( angular . isDefined ( scope . $jhandle ) ) { scope . $jhandle . forEach ( function ( handle ) { jolokia . unregister ( handle ) ; } ) ; delete scope . $jhandle ; } }
Register a JMX operation to poll for changes using a jolokia search using the given mbean pattern
@method registerSearch
@for Core
@static
@paran {*} jolokia
@param {*} scope
@param {String} mbeanPattern
@param {Function} callback
 /*
TODO - won't compile, and where is 'arguments' coming from?
export function registerSearch(jolokia:Jolokia.IJolokia, scope, mbeanPattern:string, callback) {
if (!angular.isDefined(scope.$jhandle) || !angular.isArray(scope.$jhandle)) {
scope.$jhandle = [];
}
if (angular.isDefined(scope.$on)) {
scope.$on('$destroy', function (event) {
unregister(jolokia, scope);
});
}
if (angular.isArray(arguments)) {
if (arguments.length >= 1) {
TODO can't get this to compile in typescript :)
let args = [callback].concat(arguments);
let args = [callback];
angular.forEach(arguments, (value) => args.push(value));
let args = [callback];
args.push(arguments);
let registerFn = jolokia.register;
let handle = registerFn.apply(jolokia, args);
scope.$jhandle.push(handle);
jolokia.search(mbeanPattern, callback);
}
} else {
let handle = jolokia.register(callback, arguments);
scope.$jhandle.push(handle);
jolokia.search(mbeanPattern, callback);
}
}
Register a JMX operation to poll for changes using a jolokia search using the given mbean pattern