Source for file dispatcher.php
Documentation is available at dispatcher.php
* Using the dispatcher class
require_once 'Event/SignalEmitter/Dispatcher.php';
$dp->register_signal ('download-begin');
$dp->register_signal ('download-progress');
$dp->register_signal ('download-complete');
echo 'Log: ' . implode(' - ', $args) . "\n";
public function download ($file) {
echo "Beginning download\n";
//simulate some downloading process
for ($nA = 0; $nA < 100; $nA += 10 ) {
$dp->emit ('download-progress', $file, $nA);
$dp->emit ('download-complete', $file);
$dp->connect_simple ('download-begin' , array ($l, 'log'), 'begin download');
$dp->connect_simple ('download-progress', array ($l, 'log'), 'progress');
$dp->connect_simple ('download-complete', array ($l, 'log'), 'download complete');
$dp->connect_simple ('download-begin' , array ($d, 'download'));
$dp->emit ('download-begin', 'http://some.where/over/the/rainbow.htm');
Documentation generated on Mon, 11 Mar 2019 15:41:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|