so I want to use ES6: arrow functions and classes (cause I think it could be a good way to implement OOP overriding as I have lot of similar code in two methods). but meteor (babel) says there are errors, here’s the code
base(_id, id) => { this._id = _id this.id = id check(_id, String); check(id, String); // Show the latency compensations Meteor._sleepForMs(500); // add user authorization const createdAt = new Date(); const author = 'The User'; // need to impelment User accounts const like = {_id, id, author, createdAt}; db() { // what error ???? it's ES6 class Likes.insert(like); } };
export default function () {
Meteor.methods({ // refactor: add - remove OOP, whether post or comment (id) handle in client
'likes.add' = new this.base(_id, id);
'likes.remove' = new this.base(_id, id) {
db() => {
Likes.remove(like);
}
}
}
});
}
my question is how to use it the right way. And why the fuck is this formatting so ugly? I put the code in code in “code” element tried ctrl+shift+c but still the same