Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android - object #FileReader has no method addEventListener #41

Open
markhill opened this issue Jul 3, 2013 · 0 comments
Open

Android - object #FileReader has no method addEventListener #41

markhill opened this issue Jul 3, 2013 · 0 comments

Comments

@markhill
Copy link

markhill commented Jul 3, 2013

While running Moxie under android (4.0.3) I get the above error when doing this for example:

var fi=new mOxie.FileInput({
browse_button: 'mybutton',
accept:'image.*'
});
fi.addEventListener('change', function(e){
var fr=new mOxie.FileReader();
fr.onload=function(e){console.log('loaded');};
fr.readAsDataURL(this.files[0]);
});

I replaced the event setup code in FileReader.read with this:

function removeEventListeners() {
Basic.each(events, function(name) {
if (fr.removeEventListener)
fr.removeEventListener(name, reDispatch);
else
fr['on'+name]=null;
});
if (fr.removeEventListener)
fr.removeEventListener('loadend', removeEventListeners);
else
fr.onloadend=null;
}

Basic.each(events, function(name) {
if (fr.addEventListener)
fr.addEventListener(name, reDispatch);
else
fr['on'+name]=reDispatch;
});
if (fr.addEventListener)
fr.addEventListener('loadend', removeEventListeners);
else
fr['onloadend']=removeEventListeners;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant