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

about setImmediate #77

Open
ziyoren opened this issue Jul 16, 2019 · 0 comments
Open

about setImmediate #77

ziyoren opened this issue Jul 16, 2019 · 0 comments

Comments

@ziyoren
Copy link

ziyoren commented Jul 16, 2019

ExifImage.js source code (line 116)

  var self=this;
  setImmediate(function() {
    self.loadImage(ops.image, function (error, exifData) {
      if (error) {
        return callback(error);
      }
    
      callback(null, exifData, ops.image);
    });
  });

setImmediate method is not expected to become standard, and is only implemented by recent builds of Internet Explorer and Node.js 0.10+.
Reference: Window.setImmediate()

To be compatible with more browsers, change to:

  var self=this;
    function _loadImg() {
        self.loadImage(ops.image, function (error, exifData) {
            if (error) {
                return callback(error);
            }

            callback(null, exifData, ops.image);
        });
    }
  try {
      setImmediate(_loadImg);
  }catch (e) {
      setTimeout(_loadImg, 0);
  }
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