psd.js icon indicating copy to clipboard operation
psd.js copied to clipboard

ReferenceError: finish is not defined

Open Ahuiorg opened this issue 3 years ago • 1 comments

An ReferenceError will be reported whenever the .tree() method is called;

ReferenceError: finish is not defined
    at LayerMask.module.exports.LayerMask.parse (layer_mask.js?4e92:62)
    at LazyExecute.module.exports.LazyExecute.load (lazy_execute.js?9d8a:69)
    at LazyExecute.get (lazy_execute.js?9d8a:51)
    at PSD.get (psd.js?90fd:38)
    at Root.module.exports.Root.buildHeirarchy (root.js?400c:80)
    at new Root (root.js?400c:38)
    at PSD.module.exports.PSD.tree (psd.js?90fd:81)
    at eval (PSD.vue?fac1:60)
    at tryCatch (rsvp.es.js?6b74:519)
    at invokeCallback (rsvp.es.js?6b74:532)

my code:

import PSD from 'psd.js';
onChange(file) {
  const url = URL.createObjectURL(file);
  PSD.fromURL(url)
    .then((psd) => {
      let data = JSON.stringify(psd.tree().export());
      // console.log(data);
    })
    .catch((e) => {
      console.log(e);
    });
},

I found in your source code that in line 62 and line 65 in the layer_mask.js file, finish is indeed not defined

Ahuiorg avatar Nov 11 '21 10:11 Ahuiorg

This problem is only found in version 3.3.17-beta.6, this version is used on npm, and version 3.3.17 is normal

Ahuiorg avatar Nov 11 '21 10:11 Ahuiorg