creativelive/appear

Appear not defined

vtvhunter opened this issue · 7 comments

Hi,

We were using an earlier version of appear.js (1.0.3) and we were able to use it fine (called it using the sample code you provided on your website, appear({object content here})).
I tried a new project with the latest version and I am getting "appear is not defined" error inside Console. Do we need to assign it to a variable or another object and then execute it? Or does it has something to do with module imports/exports? Sorry, i'm not the most experienced person with JS but just noticed this and wanted to know if it had something to do with the way I was calling it or not.

Thanks

Same issue here.

Also having the same issue.

This was introduced in the recent change to be compatible with webpack. The extra nested return function(obj) is not actually being executed, just defined, so this file no longer works to just load as a script in html.

so this file no longer works to just load as a script in html.

So how do I load it into html so I can use it as before?

Appear.js' example is not working.

<script src="http://localhost/js/appear.min.js"></script>
<script type="text/javascript">
var trackElementsViews = appear({
  init: function init(){
    console.log('dom is ready');
  },
  elements: function elements(){
    // work with all elements with the class "track"
    return document.getElementsByClassName('track');
  },
  appear: function appear(el){
    console.log('visible', el);
  },
  disappear: function disappear(el){
    console.log('no longer visible', el);
  },
  bounds: 200,
  reappear: true
});
</script>

Firefox console displays: ReferenceError: appear is not defined.

What can I do to solve this?

Anyway, the older version (practically the same as the newer version) is working as I expect.

For those still looking for a fix to this bug, there is an open pull request from @tehmi2000 that fixes it. It worked for me, you should get the updated code from here