mirror of
https://github.com/liabru/matter-js.git
synced 2025-01-12 16:08:50 -05:00
catch missing plugin require in examples
This commit is contained in:
parent
2ade78fb75
commit
1ba125582f
2 changed files with 20 additions and 12 deletions
|
@ -1,12 +1,16 @@
|
|||
var Example = Example || {};
|
||||
|
||||
Example.avalanche = function() {
|
||||
if (typeof MatterWrap !== 'undefined') {
|
||||
// either use by name from plugin registry (Browser global)
|
||||
Matter.use('matter-wrap');
|
||||
} else {
|
||||
// or require and use the plugin directly (Node.js, Webpack etc.)
|
||||
Matter.use(require('matter-wrap'));
|
||||
try {
|
||||
if (typeof MatterWrap !== 'undefined') {
|
||||
// either use by name from plugin registry (Browser global)
|
||||
Matter.use('matter-wrap');
|
||||
} else {
|
||||
// or require and use the plugin directly (Node.js, Webpack etc.)
|
||||
Matter.use(require('matter-wrap'));
|
||||
}
|
||||
} catch (e) {
|
||||
// could not require the plugin or install needed
|
||||
}
|
||||
|
||||
var Engine = Matter.Engine,
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
var Example = Example || {};
|
||||
|
||||
Example.ballPool = function() {
|
||||
if (typeof MatterWrap !== 'undefined') {
|
||||
// either use by name from plugin registry (Browser global)
|
||||
Matter.use('matter-wrap');
|
||||
} else {
|
||||
// or require and use the plugin directly (Node.js, Webpack etc.)
|
||||
Matter.use(require('matter-wrap'));
|
||||
try {
|
||||
if (typeof MatterWrap !== 'undefined') {
|
||||
// either use by name from plugin registry (Browser global)
|
||||
Matter.use('matter-wrap');
|
||||
} else {
|
||||
// or require and use the plugin directly (Node.js, Webpack etc.)
|
||||
Matter.use(require('matter-wrap'));
|
||||
}
|
||||
} catch (e) {
|
||||
// could not require the plugin or install needed
|
||||
}
|
||||
|
||||
var Engine = Matter.Engine,
|
||||
|
|
Loading…
Reference in a new issue