Skip to content

2.2.0

Compare
Choose a tag to compare
@lukejagodzinski lukejagodzinski released this 26 Oct 19:40
· 163 commits to v2 since this release
  • New class property meteorMethods for defining Meteor methods that will be executed on the client and server like regular Meteor methods.
const User = Class.create({
  name: User,
  collection: Users,
  fields: {
    firstName: String,
    lastName: String
  },
  meteorMethods: {
    rename(first, last, invocation) {
      // invocation.isSimulation;
      // invocation.unblock();
      this.firstName = first;
      this.lastName = last;
      this.save();
    }
  }
});
const u = User.findOne();
// Possible ways of invocations.
u.rename('John', 'Smith', (err, result) => {
});
u.callMethod('rename', 'John', 'Smith', (err, result) => {
});
u.applyMethod('rename', ['John', 'Smith'], (err, result) => {
});

You can read more about Meteor methods in docs

  • methods have been renamed to helpers. You can still use the methods property but it's deprecated and will be removed in the future Astronomy releases.