yosuke-furukawa / koa-livereload

livereload script appender for Koa
45 stars 3 forks source link

failed to use livereload in example #8

Open micosty opened 8 years ago

micosty commented 8 years ago

app.use(livereload());

assert.js:89 throw new assert.AssertionError({ ^ AssertionError: app.use() requires a generator function

micosty commented 8 years ago

should I upgrade to koa2?

yosuke-furukawa commented 8 years ago

your current version is v1? or v2?

micosty commented 8 years ago

i had tried koa v1.2.2 & v2.0.0, node version v0.12.5 & v5.7.1. All report same error: "app.use() requires a generator function"

Froguard commented 8 years ago

I got the same error just use as silmple example......

app.use(livereload());

Error:

assert.js:90
  throw new assert.AssertionError({
  ^

koa version is

"koa": "^1.2.0",
Froguard commented 8 years ago

It looks like u`d better write like this:

// return (ctx, next) => next().then(() => { 
    return function*(next) {
        var ctx = this;
        yield next;
        ...
        ...
        ...
//});
   };

I have tried like this,and it doesn't report error.

It looks like koa -v1 doesn't support the way of promise?I don`t know...