using babel-preset-env with targets safari 6 (with upgraded @babel/cli)
proper Function+arguments workaround
// func.apply(void 0, ...args) doesn't work with some
// special functions in older JSC versions (eg. OSX 10.11)
// - use Function instead of eval
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
// - beware of arguments gotchas
// see https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments
const args = [structPtr, selector]; [].push.apply(args, arguments);
const argsStr = args.map((_, i)=> `args[${i}]`).join(',');
return Function(`"use strict";return function (fn, args) { return fn(${argsStr}) }`)()(func, args);
I'm running El Capitan for "reasons", and many other have had this issue. This is a more robust and less hacky way than the previous attempts. My main issue which this solves (tested by npm link):
fixes #2, closes #4, closes #1
I'm running El Capitan for "reasons", and many other have had this issue. This is a more robust and less hacky way than the previous attempts. My main issue which this solves (tested by npm link):
https://github.com/skpm/sketch-module-web-view/issues/51 and https://github.com/skpm/sketch-dev-tools/issues/24
also: https://github.com/airbnb/react-sketchapp/issues/106