Skip to content

Commit

Permalink
Merge pull request #17 from AdobeXD/uxp-storage-module
Browse files Browse the repository at this point in the history
Uxp storage module
  • Loading branch information
pklaschka committed Aug 31, 2018
2 parents 79f2aa3 + 56b7430 commit 6962587
Show file tree
Hide file tree
Showing 2 changed files with 496 additions and 2 deletions.
7 changes: 6 additions & 1 deletion sample.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const {Text, Ellipse, Color} = require("scenegraph");
const clipboard = require("clipboard");
const shell = require("uxp").shell;
const fs = require("uxp").storage.localFileSystem;

/**
* @param {Selection} selection
* @param {RootNode} documentRoot
*/
function test(selection, documentRoot) {
async function test(selection, documentRoot) {
selection.items.forEach(node => {
console.log("Hello world: ", node);
if (node instanceof Text) {
Expand All @@ -16,6 +17,10 @@ function test(selection, documentRoot) {
shell.openExternal('https://adobe-xd.gitbook.io/plugin-api-reference/uxp-api-reference/network-apis/shell');
}
});
const tempFolder = await fs.getTemporaryFolder();
const newFile = await tempFolder.createEntry("tempfile.txt", {overwrite: true});
newFile.write("Hello, world!");
await newFile.moveTo(tempFolder, {overwrite: true});
}

module.exports = {
Expand Down
Loading

0 comments on commit 6962587

Please sign in to comment.