Git Product home page Git Product logo

w4g1 / multithreading Goto Github PK

View Code? Open in Web Editor NEW
296.0 5.0 10.0 439 KB

⚡ Multithreading functions in JavaScript to speedup heavy workloads, designed to feel like writing vanilla functions.

Home Page: https://multithreading.io

License: MIT License

TypeScript 66.81% JavaScript 33.19%
es6-generators multithreading threads webworkers worker-threads concurrency javascript multi-threading nodejs parallel-processing

multithreading's Introduction

multithreading's People

Contributors

w4g1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

multithreading's Issues

use this library for 3rd party scripts

hey - found this after 20 in search, and is not an issue, is more a question... could this library be used to load 3rd party scripts as google tag manager or analytics? I know that SW cannot access to the page, but I'm not an expert on this item.

I'm thinking something like...

html

<body>

      <!-- Example of custom type script -->
      <script type="type/multithreading">
        console.log('Script 1 is running.');
        // Additional JavaScript code for Script 1...
    </script>

    <script type="type/multithreading">
        console.log('Script 2 is running.');
        // Additional JavaScript code for Script 2...
    </script>

    <!-- Standard script to execute custom type scripts -->
   
    <div id="app"></div>
    <script type="module" src="/main.js"></script>

  </body>

js

import { threaded } from "multithreading";

const add = threaded(function* (a, b){
    document.querySelectorAll('script[type="type/multithreading"]').forEach(script => {
      try {
          new Function(script.innerText)();
      } catch (e) {
          console.error('Error executing multithreading script:', e);
      }
  });
});
await add()

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.