Ejemplo n.º 1
0
        it('should support subscribe once', function () {
            var value = 0;
            var subscription = bus.subscribeOnce('test', function (data) {
                value++;
            });
            bus.publish('test');

            bus.publish('test');
            expect(value).to.equal(1);
            expect(subscription.isDisposed).to.be.true;
        });
Ejemplo n.º 2
0
        it('should add event to message', function () {

            bus.subscribe('test', function (msg) {
                expect(msg.event).to.equal('test');
            });
            bus.publish('test', 1);
        });
Ejemplo n.º 3
0
        it('should support regex match events', function () {
            var value = 0;
            bus.subscribe('test', function () {
                value++;
            });
            bus.subscribe('test:asdf', function () {
                value++;
            });

            bus.publish('test:asdf');
            expect(value).to.equal(2);


        });
Ejemplo n.º 4
0
 goToPodcast: function() {
     bus.publish('main-content', 'podcast');
 }
Ejemplo n.º 5
0
 goToTrubadur: function() {
     bus.publish('main-content', 'info-trubadur');
 },
Ejemplo n.º 6
0
 it('should wrap published data with a message container', function () {
     bus.subscribe('test', function (msg) {
         expect(msg.data).to.equal(1);
     });
     bus.publish('test', 1);
 });