Commit 86a28ee8 authored by Ryan LeFevre's avatar Ryan LeFevre

Add promises example

parent 77c41405
...@@ -25,7 +25,14 @@ psd.parse(); ...@@ -25,7 +25,14 @@ psd.parse();
console.log(psd.tree().export()); console.log(psd.tree().export());
console.log(psd.tree().childrenAtPath('A/B/C')[0].export()); console.log(psd.tree().childrenAtPath('A/B/C')[0].export());
psd.image.saveAsPng('./output.png').then(function () { console.log('success!') });
// You can also use promises syntax for opening and parsing
PSD.open("path/to/file.psd").then(function (psd) {
return psd.image.saveAsPng('./output.png');
}).then(function () {
console.log("Finished!");
});
``` ```
### Browser ### Browser
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment