PHP Classes

File: test/test.js

Recommend this page to a friend!
  Classes of Nikos M.  >  PHP Publish Subscribe  >  test/test.js  >  Download  
File: test/test.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: 1 year ago
Size: 1,261 bytes


Class file image Download
var PublishSubscribe = require('../src/js/PublishSubscribe.js');

console.log('PublishSubscribe.VERSION = ' + PublishSubscribe.VERSION);

function _log(evt)
    console.log({topic: evt.topic, originalTopic: evt.originalTopic, tags: evt.tags, namespaces: evt.namespaces, timestamp: evt.timestamp});

var handler1 = function(evt){
    // event abort
    //evt.abort( );
    // stop bubble propagation
    //evt.propagate( false );
    // stop propagation on same event
    //evt.stop( );
    //return false;
var handler2 = function(evt){
var handler3 = function(evt){
var handler4 = function(evt){

var pb = new PublishSubscribe( )

    .on('Topic1/SubTopic11#Tag1#Tag2', handler1)
    .on1('Topic1/SubTopic11#Tag1#Tag2@NS1', handler2)
    .on('Topic1/SubTopic11#Tag1#Tag2@NS1@NS2', handler3)
    .pipeline('Topic1/SubTopic11#Tag2#Tag1', {key1: 'value1'})
    .pipeline('Topic1/SubTopic11#Tag2#Tag1@NS1', {key1: 'value1'})
For more information send a message to info at phpclasses dot org.