export interface IMessage {
    data: {};
    name: string;
    sender: string;
}

export class Service {

    private uid : number;

    constructor(public _postMessage) {
        var _self = this;

    }

    private postMessage(name: string, data: {}) : void {
        var _self = this;

        var message : IMessage = {
            data: data,
            name: name,
            sender: _self.uid
        };

        _self._postMessage(JSON.stringify(message));
    }

    postResize(height: number) : void {
        var _self = this;

        _self.postMessage(
            "resize",
            {height: height}
        );
    }
}


export var factory = ($window) => new Service((...args) => $window.postMessage.apply($window, args));

export interface IMessage {
    data: {};
    name: string;
    sender: string;
}

export class Service {

    private uid : number;

    constructor(public _postMessage) {
        var _self = this;

    }

    private postMessage(name: string, data: {}) : void {
        var _self = this;

        var message : IMessage = {
            data: data,
            name: name,
            sender: _self.uid
        };

        _self._postMessage(JSON.stringify(message), "*");
    }

    postResize(height: number) : void {
        var _self = this;

        _self.postMessage(
            "resize",
            {height: height}
        );
    }
}


export var factory = ($window) => new Service((...args) => $window.postMessage.apply($window, args));

Send message to all windows (for now)
Send message to all windows (for now)
