@csegames/camelot-unchained
Version:
Camelot Unchained Client Library
29 lines (28 loc) • 976 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var events_1 = require("../events");
function eventToEvent(receive, send) {
events_1.default.on(receive, function () {
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
return events_1.default.fire.apply(events_1.default, [send].concat(params));
});
}
exports.eventToEvent = eventToEvent;
function eventMapper(evtMap, fn) {
var params = [];
for (var _i = 2; _i < arguments.length; _i++) {
params[_i - 2] = arguments[_i];
}
evtMap.map(function (evt) {
return fn.apply(void 0, [evt.receive, evt.send].concat(params));
});
}
exports.eventMapper = eventMapper;