Call one js-function from another file


Is it possible to call a javascript function in A.js from B.js ?

I want to make a global file called Pages.js which all the functions for page-transitions and changing pages is inside.
Is it possible ?

I’ve tried this, but the app crashes without any error message :slight_smile:


	<JavaScript File="JS/Pages.js" ux:Global="Pages"/>
	<JavaScript File="JS/Login.js" />


		<PageControl Active="{currentPage}">
			<Login Name="Login" /> 
			<Start Name="Start" />


  var Observable = require("FuseJS/Observable");
  var currentPage = Observable("Login");
  function changePage(name) {
  	currentPage.value = name;
  module.exports = {
  	currentPage: currentPage,
  	changePage : changePage


var Pages = require("Pages");

function login (){

module.exports = {
 login: login

<JavaScript File="JS/Pages.js" ux:Global="Pages"/>

This approach for using JS files was deprecated quite some time ago and won’t work.

Check this for instructions on how to properly include JS modules (basically you just bundle them in the .unoproj and then require).