runOnServer.js 405 B

12345678
  1. /**
  2. * Executes a function only if we are on the server. Use in combination
  3. * with package-sepcific loader functions to create a "nested" import that
  4. * prevents leakage of server-dependencies to the client.
  5. * @param fct {function} the function to be executed on the server
  6. * @return {*} a return value from the function, if there is any
  7. */
  8. export const runOnServer = fct => Meteor.isServer && fct();