I am new to javascript and trying to use some generated code and running into some issues regarding exports. As file1 is auto-generated, if possible I would prefer to edit file2 only.
In file1.js I have:
var exports = function(apiClient) {
...
this.apiClient = apiClient || ApiClient.instance;
this.listAssets = function(opts, callback) {
...
}
}
I want to use the function listAssets
in file2.js. I tried doing the following in file2.js:
var myInstance = require('../../jsCode/src/api/file1');
and then calling myInstance.getAssets()
, but that is clearly incorrect. I assume that I am missing something pretty obvious, but after looking around I still couldn't figure it out. Any direction would be appreciated.