Tern outline on using class factory



I´m using the ui5 framework and there you use typically a function to create your own classes.


		"namespace.Dependency1", "namespace.Dependency2"
], function ExampleClassFactory(dependency1, dependency2) {
	var MyClass = function() {};

	MyClass.prototype.fn1 = function(param) {};
	MyClass.prototype.fn2 = function(param) {};

	return MyClass;

Eclipse Outline works reasonable and quite better if I use the @memberOf Annotation, but Tern Outline don´t recognise the functions.

How should I write my JSDoc?

Best regards


sap.ui.define seems to be some kind of module loader. For those to work, you’ll have to create and load a plugin. In this case, the pattern looks very much like AMD, so you might be able to just take the define function from the requirejs plugin, and set sap.ui.define to that.


Thank you for your answer.

Yes you´re quite right. But this is the part to define my own modules. The loader parts are sap.ui.require() or to set it as dependency (e.g. like in the example dependency1 and dependency2).

And I found already a plugin (https://www.npmjs.com/package/tern-openui5). It descripes all framework classes and allow autocompletion but has unfortunately no effect on the tern outline.


If by ‘tern outline’ you are referring to this package, that’s a different project with a different maintainer, that I know nothing about.


Of course that´s a different package, but as far as I know is tern outline part of the default tern installation on eclipse IDEs and so I hope there are ways to get it worked with clever JSDoc or write the code in a other way. (e.g.

var MyClass = function() {
    fn1 : function(param) {},
    fn2 : function(param) {}
return MyClass