5 elgg.provide(
'elgg.config.hooks');
6 elgg.provide(
'elgg.config.instant_hooks');
7 elgg.provide(
'elgg.config.triggered_hooks');
26 elgg.register_hook_handler =
function(
name,
type, handler, priority) {
28 elgg.assertTypeOf(
'string', type);
29 elgg.assertTypeOf(
'function', handler);
35 var hooks =
elgg.config.hooks;
39 if (!(hooks[
name][type] instanceof
elgg.ElggPriorityList)) {
44 if (
elgg.is_instant_hook(
name, type) &&
elgg.is_triggered_hook(
name, type)) {
45 handler(
name, type, null, null);
48 return hooks[
name][
type].insert(handler, priority);
77 elgg.assertTypeOf(
'string', type);
83 value = !
elgg.isNullOrUndefined(value) ? value : null;
85 var hooks =
elgg.config.hooks,
86 tempReturnValue = null,
88 callHookHandler =
function(handler) {
89 tempReturnValue = handler(
name, type, params, returnValue);
90 if (!
elgg.isNullOrUndefined(tempReturnValue)) {
91 returnValue = tempReturnValue;
96 elgg.provide([
'all', type], hooks);
98 elgg.provide([
'all',
'all'], hooks);
102 if (
name !=
'all' && type !=
'all') {
103 hooksList.push(hooks[
name][type]);
107 hooksList.push(hooks[
'all'][type]);
111 hooksList.push(hooks[
name][
'all']);
114 hooksList.push(hooks[
'all'][
'all']);
116 hooksList.every(
function(handlers) {
117 if (handlers instanceof
elgg.ElggPriorityList) {
118 handlers.forEach(callHookHandler);
141 elgg.assertTypeOf(
'string', type);
143 return elgg.push_to_object_array(
elgg.config.instant_hooks,
name, type);
153 return elgg.is_in_object_array(
elgg.config.instant_hooks,
name, type);
163 return elgg.push_to_object_array(
elgg.config.triggered_hooks,
name, type);
173 return elgg.is_in_object_array(
elgg.config.triggered_hooks,
name, type);
176 elgg.register_instant_hook(
'init',
'system');
177 elgg.register_instant_hook(
'ready',
'system');
178 elgg.register_instant_hook(
'boot',
'system');