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 __());
};
///<reference path="./IOutputFormatter.ts" />
///<reference path="../../../base/BaseClass.ts" />
var econda;
(function (econda) {
var tagmanager;
(function (tagmanager) {
var macro;
(function (macro) {
var output;
(function (output) {
var BaseClass = econda.base.BaseClass;
/**
* Returns a JavaScript function call that will return the current value for given macro name.
* @class econda.tagmanager.macro.output.JsFormatter
*/
var JsFormatter = (function (_super) {
__extends(JsFormatter, _super);
function JsFormatter(cfg) {
_super.call(this);
this._containerVarName = null;
if (cfg instanceof JsFormatter) {
return this;
}
this.initConfig(cfg);
}
JsFormatter.prototype.setContainerVarName = function (varName) {
this._containerVarName = varName;
return this;
};
JsFormatter.prototype.getContainerVarName = function () {
return this._containerVarName;
};
JsFormatter.prototype.format = function (macroName, value) {
return 'window.' + this._containerVarName + '.getValueByName("' + String(macroName).replace(/["]/, function (c) { return '\\' + c; }) + '")';
};
return JsFormatter;
}(BaseClass));
output.JsFormatter = JsFormatter;
})(output = macro.output || (macro.output = {}));
})(macro = tagmanager.macro || (tagmanager.macro = {}));
})(tagmanager = econda.tagmanager || (econda.tagmanager = {}));
})(econda || (econda = {}));