Skip to content

Commit

Permalink
Cleanup sample usage for stream joystick
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed Mar 4, 2015
1 parent 1d9f29e commit 3ed9b07
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions examples/linux-joystick-stream.lua
Expand Up @@ -24,13 +24,9 @@ function JoystickTransform:_transform(chunk, _, callback)
callback()
end

--------------------------------------------------------------------------------

local input = fs.createReadStream("/dev/input/js0", { chunkSize = 8 })
local events = JoystickTransform:new()
input:pipe(events)

events:on("data", p)
input:on("error", error)
events:on("error", error)

coroutine.yield()
-- Sample usage
fs.createReadStream("/dev/input/js0", { chunkSize = 8 })
:pipe(JoystickTransform:new())
:on("data", p)

0 comments on commit 3ed9b07

Please sign in to comment.