Giter Club home page Giter Club logo

sketch-sandbox's Introduction

Sketch Sandbox

A small library to get around sandbox issues in Sketch.

Why?

I'll write a real explanation when I have the time, but if you don't know why you need this, this is definitely not for you :)

The library is not heavily tested, so please file an issue if it doesn't work for you :)

Usage

  • include the 'sandbox.js' library in your plugin, using #import 'sandbox.js'

  • ask the user to authorize a path, like this:

      new AppSandbox().authorize(path, callback)
    

    where path is an absolute path to a folder, and callback is a JavaScript function that will be executed if the user authorizes the operation.

Notes

  • Once a user authorizes a folder, you'll be able to write to its subfolders.

Example

This is my personal favorite way of dealing with sandboxing issues: just ask the user for permission to write to her $HOME folder:

var home_folder = "/Users/" + NSUserName()
new AppSandbox().authorize(home_folder, function(){
  // do whatever you need to do here
})

This is probably overkill, unsafe, and unreasonable to ask. But on the other hand, you'll only need the user to authorize Sketch once (regardless of the plugin, authorization is per-app, not per-plugin :). As explained in the Notes section, once the user authorizes its $HOME folder, you'll be able to read & write from its subfolders (including the 'Documents' and 'Dropbox' folders :)

sketch-sandbox's People

Contributors

bomberstudios avatar iansilber avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.