def formatProperties(namespace): formatter = Formatter(METHOD_INDENTATION) for property in namespace['properties']: formatter.add(generatePropertyJSDoc(property)) formatter.addLine(convertKey(property['name']), ':null,') formatter.newLine() return formatter.getResult()
def formatMethods(namespace): formatter = Formatter(METHOD_INDENTATION) for method in namespace['methods']: formatter.add(generateMethodJSDoc(method)) formatter.addLine('this.', convertIds(method['name']), ' = function(', formatParams(method['parameters']), ") {") formatter.addLine('};') formatter.newLine() return formatter.getResult()
def extendGlobal(name, namespace): formatter = Formatter(METHOD_INDENTATION) for method in namespace['methods']: formatter.add(generateMethodJSDoc(method)) formatter.addLine(name, '.prototype.', convertKey(method['name']), ' = function(', formatParams(method['parameters']), ") {") formatter.addLine('};') formatter.newLine() return formatter.getResult()
def formatGlobal(namespace): formatter = Formatter(METHOD_INDENTATION) for method in namespace['methods']: formatter.add(generateMethodJSDoc(method)) formatter.addLine('function ', convertKey(method['name']), '(', formatParams(method['parameters']), ") {") formatter.addLine('}') formatter.newLine() return formatter.getResult()
def formatMethods(namespace): formatter = Formatter(METHOD_INDENTATION) key = 'methods' if 'methods' in namespace else 'method' for method in namespace[key]: formatter.add(generateMethodJSDoc(method)) formatter.addLine(convertKey(method['name']), ':function(', formatParams(method['parameters']), ") {") formatter.addLine('},') formatter.newLine() return formatter.getResult()