toddmotto / echo

Lazy-loading images with data-* attributes
http://toddmotto.com/labs/echo
3.72k stars 504 forks source link

Commonjs way #79

Open lichunqiang opened 9 years ago

lichunqiang commented 9 years ago

Hi, I have one question.

In this line: https://github.com/toddmotto/echo/blob/master/dist/echo.js#L8

why not do module.exports = factory(root) ?

By default , I will get a function , I should do call it to get the object.

this is by design?

Thanks!

mikaelgson commented 9 years ago

+1 - To get around this one needs to invoke with var echo = require('echo')(window); and that does not seem to be be intended by the look of the documentation.