Error with onBeforeAction

NewPostController = BaseController.extend({
template: ‘newPost’,

onBeforeAction(function(){
if (!Meteor.user()) {
if (Meteor.loggingIn()) {
this.render(this.loadingTemplate);
} else {
this.render(‘accessDenied’);
}
} else {
this.next();
}
});
});

This is my code. But when I run it show this error:

=> Errors prevented startup:

While processing files with ecmascript (for target web.browser):
lib/controller/new_post.js:4:17: Unexpected token (4:17)

While processing files with ecmascript (for target os.linux.x86_64):
lib/controller/new_post.js:4:17: Unexpected token (4:17)

=> Your application has errors. Waiting for file change.

I don’t no the problem. Please help me to fix it.

Thanks a lot.

onBeforeAction is a key, not a method. You assign a callback to it.
Simply, instead of this
onBeforeAction(callback)
try this
onBeforeAction: callback

Yes, This is mistake. thanks you very much