UNPKG

service-model

Version:

An object oriented web service framework inspired by Windows Communication Foundation.

40 lines (39 loc) 1.4 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var messageFilter_1 = require("./messageFilter"); /** * A message filter that filters messages based on the message url path. The message is considered a match * if the path in the url of the message is exactly the same as the path in the url of the filter. * * <uml> * hide members * hide circle * MessageFilter <|-- AddressMessageFilter * </uml> */ var AddressMessageFilter = (function (_super) { __extends(AddressMessageFilter, _super); /** * Constructs an AddressMessageFilter object. * @param url The url to match. */ function AddressMessageFilter(url) { _super.call(this); if (!url) { throw new Error("Missing required argument 'url'."); } this._url = url; } /** * Tests whether or not the message satisfies the criteria of the filter. * @param message The message to match. */ AddressMessageFilter.prototype.match = function (message) { return message.url.pathname === this._url.pathname; }; return AddressMessageFilter; })(messageFilter_1.MessageFilter); exports.AddressMessageFilter = AddressMessageFilter;