Tastenkunst / brfv4_javascript_examples

BRFv4 - HTML5/Javascript - examples project. Reference implementation for all other platform example packages.
463 stars 148 forks source link

BRFv4.js (paid version) not working in Web Worker mode #12

Closed brandon-vb closed 6 years ago

brandon-vb commented 7 years ago

Seeing comparable behavior to that described in: https://github.com/Tastenkunst/brfv4_javascript_examples/issues/1

Like described in issue #1 , we see the error "ReferenceError: Can't find variable: require".

Was there ever progress made on the resolution of this issue?

MarcelKlammer commented 7 years ago

Currently there is no web worker option for BRFv4. I might look into it at some point.

super-dog-human commented 6 years ago

Hi there. I just succeeded in running BRFv4 (trial version) in web workers.

BRFv4_JS_TK101018_v4.1.0_trial.js needs os and https modules in runtime, So I added following lines to top of files.

// BRFv4_JS_TK101018_v4.1.0_trial.js`
require('os')
require('https')
export function initializeBRF(brfv4) { /* function implementation */ }
// "export" statement enable to calling this function from another module when imported.

In worker, just import this file.

// myWorker.js
import { initializeBRF } from './BRFv4_JS_TK101018_v4.1.0_trial'

Made in this, initializeBRF can be called from worker and works fine.

Note: To using require, import, and export statement need webpack tools like babel. (I'm using parcel)

MarcelKlammer, Thank you for creating the great library.

MarcelKlammer commented 5 years ago

58