Skip to content

about setImmediate #77

Description

@ziyoren

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);
  }

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions