all files / dist/writers/ InterfaceWriter.js

100% Statements 58/58
100% Branches 0/0
100% Functions 16/16
100% Lines 58/58
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78  11× 11× 11× 11× 11× 11× 11× 11× 11× 11× 11×                                      
"use strict";
var InterfaceWriter = (function () {
    function InterfaceWriter(writer, baseDefinitionWriter, documentationedWriter, exportableWriter, ambientableWriter, typeParametersWriter, propertyWriter, methodWriter, callSignatureWriter, indexSignatureWriter, extendsImplementsWriter) {
        this.writer = writer;
        this.baseDefinitionWriter = baseDefinitionWriter;
        this.documentationedWriter = documentationedWriter;
        this.exportableWriter = exportableWriter;
        this.ambientableWriter = ambientableWriter;
        this.typeParametersWriter = typeParametersWriter;
        this.propertyWriter = propertyWriter;
        this.methodWriter = methodWriter;
        this.callSignatureWriter = callSignatureWriter;
        this.indexSignatureWriter = indexSignatureWriter;
        this.extendsImplementsWriter = extendsImplementsWriter;
    }
    InterfaceWriter.prototype.write = function (def, flags) {
        var _this = this;
        this.baseDefinitionWriter.writeWrap(def, function () {
            _this.writeHeader(def, flags);
            _this.writer.block(function () {
                _this.writeNewSignatures(def, flags);
                _this.writeCallSignatures(def, flags);
                _this.writeIndexSignatures(def);
                _this.writeProperties(def, flags);
                _this.writeMethods(def, flags);
            });
        });
    };
    InterfaceWriter.prototype.writeHeader = function (def, flags) {
        this.documentationedWriter.write(def);
        this.exportableWriter.writeExportKeyword(def, flags);
        this.ambientableWriter.writeDeclareKeyword(def);
        this.writer.write("interface ").write(def.name);
        this.typeParametersWriter.write(def.typeParameters);
        this.extendsImplementsWriter.writeExtends(def);
    };
    InterfaceWriter.prototype.writeNewSignatures = function (def, flags) {
        var _this = this;
        def.newSignatures.forEach(function (n) {
            _this.writer.write("new");
            _this.callSignatureWriter.write(n, flags);
            _this.writer.write(";").newLine();
        });
    };
    InterfaceWriter.prototype.writeCallSignatures = function (def, flags) {
        var _this = this;
        def.callSignatures.forEach(function (c) {
            _this.callSignatureWriter.write(c, flags);
            _this.writer.write(";").newLine();
        });
    };
    InterfaceWriter.prototype.writeIndexSignatures = function (def) {
        var _this = this;
        def.indexSignatures.forEach(function (s) {
            _this.indexSignatureWriter.write(s);
            _this.writer.write(";").newLine();
        });
    };
    InterfaceWriter.prototype.writeProperties = function (def, flags) {
        var _this = this;
        def.properties.forEach(function (p) {
            _this.propertyWriter.write(p, flags);
            _this.writer.newLine();
        });
    };
    InterfaceWriter.prototype.writeMethods = function (def, flags) {
        var _this = this;
        def.methods.forEach(function (m) {
            _this.methodWriter.write(m, flags);
            _this.writer.newLine();
        });
    };
    return InterfaceWriter;
}());
exports.InterfaceWriter = InterfaceWriter;
 
//# sourceMappingURL=InterfaceWriter.js.map