From 3b38e067fd89ff95492c1951854f1754d668dfdc Mon Sep 17 00:00:00 2001 From: yehudah Date: Thu, 26 Sep 2019 14:19:52 +0000 Subject: add new js file --- script/post-smtp-hooks.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 script/post-smtp-hooks.js (limited to 'script') diff --git a/script/post-smtp-hooks.js b/script/post-smtp-hooks.js new file mode 100644 index 0000000..092f024 --- /dev/null +++ b/script/post-smtp-hooks.js @@ -0,0 +1,15 @@ +var Hook = { + hooks: [], + + register: function ( name, callback ) { + if( 'undefined' == typeof( Hook.hooks[name] ) ) + Hook.hooks[name] = [] + Hook.hooks[name].push( callback ) + }, + + call: function ( name, arguments ) { + if( 'undefined' != typeof( Hook.hooks[name] ) ) + for( i = 0; i < Hook.hooks[name].length; ++i ) + if( true != Hook.hooks[name][i]( arguments ) ) { break; } + } +} \ No newline at end of file -- cgit v1.2.3