pixi.js / packages / unsafe-eval /
@Matt Karl Matt Karl authored on 19 May 2019
..
src Introduces unsafe-eval and runner packages (#5463) 6 years ago
LICENSE Introduces unsafe-eval and runner packages (#5463) 6 years ago
README.md Introduces unsafe-eval and runner packages (#5463) 6 years ago
package.json v5.0.3 5 years ago
README.md

@pixi/unsafe-eval

Adds support for environments that disallow support of new Function, such as WeChat.

Installation

npm install @pixi/unsafe-eval

Usage

If you are using a bundler, you need to pass the core bundle into the install method. This function takes one arguments, either the global PIXI object, or the core.

import * as PIXI from '@pixi/core';
import { install } from '@pixi/unsafe-eval';

// Apply the patch to PIXI
install(PIXI);

// Create the renderer with patch applied
const renderer = new PIXI.Renderer();

If you are including unsafe-eval.js direct, you do not need to do anything else:

<script src="pixi.min.js"></script>
<script src="unsafe-eval.min.js"></script>