nkzawa / socket.io-stream

Stream for Socket.IO
MIT License
612 stars 111 forks source link

using generator in callback #90

Closed philions closed 8 years ago

philions commented 8 years ago

code like:

const co = require('co')

function *saveFile(){
    //do something
}

co(function*(){
    // missing some code above   
    io.of('/user').on('connection', function(socket) {
    ss(socket).on('profile-image', function(stream, data) {
        yield *saveFile()
    });
    });
})

always give me error: ReferenceError: yield is not defined

anybody figure me out!