promise icon indicating copy to clipboard operation
promise copied to clipboard

async/await error: Unexpected token function

Open JulianKingman opened this issue 10 years ago • 8 comments

I'm getting an 'Unexpected token' error when I try to use the async/await pattern. My code looks something like this, any idea what I'm doing wrong?

Template.fragments.events({
    'submit .copyContent': async function(e,t){
    var text = await Meteor.call('getContent', selector);
    console.log(text.split"<p>");
});

I posted the same issue here: https://github.com/okgrow/meteor-promise/issues/4

JulianKingman avatar Sep 16 '15 04:09 JulianKingman

Yeah, async functions are currently not enabled by the ecmascript package, though I am eager to consider enabling them if there is interest.

benjamn avatar Sep 16 '15 05:09 benjamn

I'm interested!

stubailo avatar Sep 16 '15 05:09 stubailo

I’m obviously interested :)

I’ve been trying to understand how the example of the async/await pattern is used on okgrow:promise’s example: http://okgrow-promise.meteor.com/ I tried with grigio:babel, but it gave me the same error, and okgrow is now deprecated, so I assumed the same functions would be carried over into this package.

JulianKingman avatar Sep 16 '15 05:09 JulianKingman

Thirded, interested!

lourd avatar Sep 16 '15 15:09 lourd

Hi @benjamn any news on async/await support? I can enable this my self on babel settings or ... ?

bySabi avatar Sep 28 '15 22:09 bySabi

Please enable this

ShimShamSam avatar Nov 15 '15 01:11 ShimShamSam

I'm also interested in this

purplecones avatar Jun 16 '16 15:06 purplecones

@purplecones It's supported in Meteor 1.3+

ShimShamSam avatar Jun 16 '16 15:06 ShimShamSam