(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var BaseChannel = (function () {
        function BaseChannel(options) {
            this.url = options.url;
            this.sessionId = options.sessionId;
        }
        /**
         * Send a message, or schedule it to be sent. Return a promise that resolves when the message has been sent.
         */
        BaseChannel.prototype.sendMessage = function (name, data) {
            if (data instanceof Error) {
                data = { name: data.name, message: data.message, stack: data.stack };
            }
            return this._sendData(name, data);
        };
        return BaseChannel;
    }());
    exports.default = BaseChannel;
    function isChannel(value) {
        return value && typeof value === 'object' && typeof value.sendMessage === 'function';
    }
    exports.isChannel = isChannel;
});
//# sourceMappingURL=Base.js.map