1.0.2 • Published 8 years ago

sketchfetch v1.0.2

Weekly downloads
3
License
MIT
Repository
-
Last release
8 years ago

sketchfetch

npm Sketch.app

~= fetch for Sketch, using Futures

import fetch from 'sketchfetch';

fetch('https://reqres.in/api/users').fork(
  err => log('error, fella'),
  res => {
    log('result!');
    log(res);
  }
);
// 'result!'
// { data: […] }

fetch('https://reqres.in/api/users', {
  method: 'POST',
  body: {
    'name': 'Matthew McConaughey'
  }
}).fork…

Remember to call fork(err => err, result => result) on the returned Future to run it!

Rationale

  • sketch's JS runtime doesn't support fetch or XMLHttpRequest so we can't use any normal polyfills
  • NSURLConnections take a ton of code to set up
  • no time for that…

TODOs

  • list out unsupported cases
  • switch to async requests
1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago