waylonflinn / weblas

GPU Powered BLAS for Browsers :gem:
MIT License
702 stars 43 forks source link

Runtime failures during 'strict mode' #52

Open psybuzz opened 4 years ago

psybuzz commented 4 years ago

Running weblas in a browser's 'strict mode' will throw runtime errors.

Repro: see https://jsfiddle.net/u7by8azp/, created by pasting dist/weblas.js into a script with 'use strict' at the top. Expected: no console errors in devtools Actual:

Uncaught ReferenceError: p is not defined
    at new DownsampleCalculator

This makes it challenging to use weblas as an external dependency when building a project that bundles or concatenates it with other scripts that have strict mode enabled.

It seems that if we patch a couple instances in weblas code, adding var before variable declarations, this should work: https://jsfiddle.net/cft3aqvu/