PHP Classes

File: test/test_filter.js

Recommend this page to a friend!
  Classes of Nikos M.   PHP Publish Subscribe   test/test_filter.js   Download  
File: test/test_filter.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Publish Subscribe
Register and call handlers of events by name
Author: By
Last change:
Date: 3 years ago
Size: 905 bytes


Class file image Download
"use strict"; var PublishSubscribe = require('../src/js/PublishSubscribe.js'), echo = console.log; echo('PublishSubscribe.VERSION = ' + PublishSubscribe.VERSION); function filter(pb, hook, value, args) { var data = {}; if ( args ) { for(var k in args) data[k] = args[k]; } data.value = value; return new Promise(function(resolve,reject){ pb.pipeline(hook, data, null, function(evt){ echo('FINISH'); resolve(; }); }); } var pb = new PublishSubscribe( ); pb.on('filter_value', function(evt){ echo(;; setTimeout(function(){;}, 100); }); pb.on('filter_value', function(evt){ echo(;;; }); pb.on('filter_value', function(evt){ echo(;;; }); filter(pb, 'filter_value', 2).then(function(value){echo(value);});