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

Events hooks fix #1

Open
GoogleCodeExporter opened this issue Feb 23, 2016 · 0 comments
Open

Events hooks fix #1

GoogleCodeExporter opened this issue Feb 23, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

I have downloaded this project to use in my app. And I have found out that 
events(onLoad, onComplete and onError) are not working properly. Java methods 
are not invoked.

After debugging, I have found the problem and here is the fix:
In WebcamImpl.java file change   private native JavaScriptObject create** 
methods to the following code:

  private native JavaScriptObject createOnErrorHook() /*-{
    var _this = this;
    return function(result) {
        _this.@com.logikas.gwt.webcam.client.WebcamImpl::fireErrorEvent(Ljava/lang/String;)(result);
    };
  }-*/;

  private native JavaScriptObject createOnLoadHook() /*-{
    var _this = this;
    return function() {
        _this.@com.logikas.gwt.webcam.client.WebcamImpl::fireLoadEvent()();
    };
  }-*/;

  private native JavaScriptObject createOnCompleteHook() /*-{
    var _this = this;
    return function(result) {
        _this.@com.logikas.gwt.webcam.client.WebcamImpl::fireCompleteEvent(Ljava/lang/String;)(result);
    };
  }-*/;

The problem was that during event, this object was different from the moment of 
function creation. Therefore it was needed to store an exact object, for which 
the function would be invoked.

Original issue reported on code.google.com by guerrill...@gmail.com on 13 Nov 2013 at 2:14

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

No branches or pull requests

1 participant