I am learning NativeScript. As part of that, I'm trying out a basic project. In that project, I'm trying to use a JavaScript file that I use for string manipulation. This file does NOT require access to browser elements like the DOM. Yet, I can't run my app when I include the file. At this time, I have the following in my ./app/home/index.js file:
var MyFile = require('../app/code/myFile.js');
...
var prefix = myFile.GetPrefix(someStringValue);
For more background:
- I've included the file in ./app/code/myFile.js.
- I've referenced the file as shown above
Here is what myFile.js looks like:
function MyClass() {}
module.exports = MyClass;
MyClass.test = function(msg) {
console.log(msg);
};
How can I use some existing JavaScript in a NativeScript app?
Thank you!
myFile.jsdo? You may not access the DOM but you may be relying onwindowor some other globals that aren't present.