How to Intercept page scroll event

I had the same error, but managed to fix it by including this in my script definition:

<script type="text/discourse-plugin" version="0.10.2">