adobe-webplatform / Snap.svg

The JavaScript library for modern SVG graphics.
http://snapsvg.io
Apache License 2.0
13.94k stars 1.15k forks source link

Not executable in Chrome App #288

Open Cloud-Automation opened 10 years ago

Cloud-Automation commented 10 years ago

Snap is not executable in Chrome Apps due to the function call

    return Function("val", "return Snap.path.toString.call([" + b + "])");

in the equal.js file. Evaluating Javascript as a string is not valid in packaged chrome apps.

How can I change that?

function getPath(path) {
    var k = 0, i, ii, j, jj, out, a, b = [];
    for (i = 0, ii = path.length; i < ii; i++) {
        out = "[";
        a = ['"' + path[i][0] + '"'];
        for (j = 1, jj = path[i].length; j < jj; j++) {
            a[j] = "val[" + (k++) + "]";
        }
        out += a + "]";
        b[i] = out;
    }
    return Function("val", "return Snap.path.toString.call([" + b + "])");
}

Thanks Stefan

mmacaula commented 6 months ago

Possible solution here: https://github.com/adobe-webplatform/Snap.svg/issues/475#issuecomment-1948547780