Global functions inside Tracker.autorun

I defined global functions on the lib folder but i cant use it in Tracker.autorun because it says that the function is undefined/.

Can we see the code where you define and use these functions?

Meteor.myStatusFunctions = {
DisableStatus : function() {

  },
 
  InsertStatus : function(text, favorite, photo, isActive) {

  },
 
  InsertTimofon : function(timeofon) {

      });
      //statusListObserver.refresh();
  },
 
  GetLastStatus :  function() {
      return statusList.findOne({
          owner: Meteor.userId()
      }, {
          sort: {
              lastActive: -1
          }
      });
  },
  ReplaceStatus : function(status) {

  },

}

its in the lib folder to load before the tracker function

So that should work, but if you’re relying on lib/ then you may be running Meteor in “classic” (pre-ES2015 import/export) mode. In which case you may still have issues with load order. Check the Guide for more information.

BTW, if you wrap your code in triple backticks like this, it gets formatted properly:

```
paste your code
in here
```
1 Like

Thank you :slight_smile: moving the folder that reads the global functions from client/lib to client solved it.

1 Like