Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clooneyjs

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clooneyjs

Clooney is an actor library for the web

  • 0.1.1
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Clooney

Clooney is an actor (ayooo) library for the web. Classes given to Clooney will be instantiated and run in a worker, keeping the main thread responsive.

Quickstart

An example says more than 1000 words:

<script src="/clooney.bundle.js"></script>
<script>
  (async function() {
    class MyRemoteClass {
      doExpensiveCalculation(a, b) {
        return a + b;
      }
    }

    const instance = await Clooney.spawn(MyRemoteClass);
    console.log(await instance.doExepensiveCalculation(5, 23));
  })();
</script>

CDN

If you want to use Clooney from a CDN, you need to work around the same-origin restrictions that workers have:

<script>
  // Disgusting monkey patch — courtesy of @developit
  var oldWorker = Worker;
  Worker = function(url, opts) {
    const blob = new Blob([`importScripts(${JSON.stringify(url)})`]);
    return new oldWorker(URL.createObjectURL(blob), opts);
  }
</script>
<script src="https://cdn.jsdelivr.net/npm/clooneyjs@0.1.1/clooney.bundle.min.js"></script>

License Apache-2.0

FAQs

Package last updated on 16 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc