Skip to content

Instantly share code, notes, and snippets.

@acarr
acarr / ui.html
Last active July 5, 2023 14:15
Example implementation of a Web Worker within a Figma plugin.
<div id="myApp">
...
</div>
<script id="quant-worker" type="javascript/worker">
<%= compilation.assets['worker.js'].source() %>
</script>
@acarr
acarr / rAF.js
Created February 24, 2012 16:20 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {