All files / mframejs/behavior signal.ts

50% Statements 6/12
0% Branches 0/4
0% Functions 0/3
45.45% Lines 5/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2829x 29x 29x   29x     29x                                        
import { behavior } from '../decorator/exported';
import { EventAggregator } from '../utils/exported';
import { ContainerClasses } from '../container/exported';
 
const eventAggregator: EventAggregator = ContainerClasses.get(EventAggregator);
 
@behavior('signal')
export class SignalBehavior {
    public name: string;
    constructor(observer: any, args: any) {
        this.name = args[0] || 'undefined';
 
        if (observer.listener && observer.listener.name === 'Interpolate') {
 
            observer.unbindBackup = observer.unbind;
 
            observer.unbind = function () {
                this.unbindBackup();
            };
 
            eventAggregator.subscribe('signal-' + this.name, function () {
                observer.update();
            });
        }
 
    }
}