breejs / bree

Bree is a Node.js and JavaScript job task scheduler with worker threads, cron, Date, and human syntax. Built for @ladjs, @forwardemail, @spamscanner, @cabinjs.
https://jobscheduler.net
MIT License
3.06k stars 79 forks source link

[feat] browser support #27

Closed niftylettuce closed 2 years ago

niftylettuce commented 4 years ago

Right now browser support is unstable due to these issues:

I previously had modified index.html with a basic example such as this:

  <script src="https://unpkg.com/bree">
  <script>
    (function() {
      function hello() {
        console.log('hello');
        postMessage('done');
      }

      var bree = new Bree({
        jobs: [
          {
            name: 'hello',
            path: hello,
            interval: '5s',
          }
        ]
      });

      bree.start();
    })();
  </script>

However since postMessage is not working, I have it commented out right now.

Note that I do expose threads from bthreads as Bree.threads, therefore one could write a browser test (e.g. with puppeteer that uses Bree.threads.backend === 'web_worker' and Bree.threads.browser === true to test that the proper backends load.

hyusetiawan commented 3 years ago

can this be worked around if it's running on electron?

shadowgate15 commented 2 years ago

I'm closing this issue since bree no longer supports the browser.

c0bra commented 2 years ago

I'm closing this issue since bree no longer supports the browser.

If that's the case, can you remove "Works in the browser" from index.html?