The following code architecture works in up to Meteor 1.0
but breaks in Meteor 1.2
Any insights/suggestions are appreciated.
in server/file1.coffee
:
class ClassA
{code for the class}
@MyObj = new ClassA()
in /lib/collections/file2.coffee
:
Meteor.methods
myFunction : ->
if Meteor.isServer
console.log 'isServer'
if MyObj?
{do stuff}
Note that while myFunction
is defined in /lib
directory and called from /client
it runs on the server in Meteor version 1.0
, as evidenced by logs printed from within that function under Meteor.isServer
. This is not the case in version 1.2
. Under 1.2
, Meteor.isServer
is never true and it’s log doesn’t print.
Has anyone seen anything like this issue ?
EDIT: this post seems to be similar: https://github.com/meteor/meteor/issues/5113 but it doesn’t have an apparent resolution.
Thanks!