Source

You can use source() to manually send events/data to your reactive flows:
  /*!*/import { source, map, group } from '@connectv/core';

/*!*/let a = source();
/*!*/let b = source();

group(a, b).to(map(v => 'from:: ' + v)).subscribe(console.log);

/*!*/a.send('A');
/*!*/b.send('B');

setInterval(() => a.send('A'), 1000);
document.addEventListener('click', () => b.send('B'));
A source is a Pin and have all of its properties, though connecting to a source can lead to unpredictable behavior.

Clearing up

Like other pin types, source() has a .clear() method that you should call when you are done with your source. This will clean up the flow and send the complete signal down the line for any such callback to handle:
  import { source, pin } from '@connectv/core';

let a = source();

a.to(pin())
 .subscribe(
   v => { console.log('GOT:: ' + v); },  //--> this is the usual callback
   error => { console.log('ERROR!'); },  //--> this is the error callback
/*!*/   () => { console.log('COMPLETE!'); }   //--> this will be called when the flow is closed off
 );

a.send(12);
a.send('YOLO!');
/*!*/a.clear();


Further reading




Copied to Clipboard!