"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const aurelia_framework_1 = require("aurelia-framework");
class ControlNameResolverService {
constructor() {
this.nameCache = [];
}
getNameForControl(control, eachModule = aurelia_framework_1.PLATFORM.eachModule) {
let found = null;
if (!control || !control.name || !control.name.length) {
return null;
}
if (this.nameCache[control.name] !== undefined) {
return this.nameCache[control.name];
}
eachModule((m, v) => {
if (v[control.name] === control)
found = m;
return true;
});
if (!found) {
eachModule((m, v) => {
if (v[control.name] && v[control.name].name === control.name)
found = m;
return true;
});
}
this.nameCache[control.name] = found;
return found;
}
}
exports.ControlNameResolverService = ControlNameResolverService;
//# sourceMappingURL=control-name-resolver-service.js.map |