From 5b0d34b9e0569927df381b1861e3e6ac03c45e6b Mon Sep 17 00:00:00 2001 From: liabru Date: Sun, 15 Sep 2019 18:36:26 +0100 Subject: [PATCH] changed demo to auto populate examples with sourceLink and init --- demo/js/Demo.js | 317 ++++++------------------------ examples/airFriction.js | 2 +- examples/avalanche.js | 2 +- examples/ballPool.js | 2 +- examples/bridge.js | 2 +- examples/broadphase.js | 2 +- examples/car.js | 2 +- examples/catapult.js | 2 +- examples/chains.js | 2 +- examples/circleStack.js | 2 +- examples/cloth.js | 2 +- examples/collisionFiltering.js | 2 +- examples/compositeManipulation.js | 2 +- examples/compound.js | 2 +- examples/compoundStack.js | 2 +- examples/concave.js | 2 +- examples/constraints.js | 2 +- examples/doublePendulum.js | 2 +- examples/events.js | 2 +- examples/friction.js | 2 +- examples/gravity.js | 2 +- examples/gyro.js | 2 +- examples/manipulation.js | 2 +- examples/mixed.js | 2 +- examples/newtonsCradle.js | 2 +- examples/pyramid.js | 2 +- examples/ragdoll.js | 2 +- examples/raycasting.js | 2 +- examples/restitution.js | 2 +- examples/rounded.js | 2 +- examples/sensors.js | 2 +- examples/sleeping.js | 2 +- examples/slingshot.js | 2 +- examples/softBody.js | 2 +- examples/sprites.js | 2 +- examples/stack.js | 2 +- examples/staticFriction.js | 2 +- examples/stress.js | 2 +- examples/stress2.js | 2 +- examples/svg.js | 2 +- examples/terrain.js | 2 +- examples/timescale.js | 2 +- examples/views.js | 2 +- examples/wreckingBall.js | 2 +- 44 files changed, 100 insertions(+), 303 deletions(-) diff --git a/demo/js/Demo.js b/demo/js/Demo.js index 40a03d5..aa910f8 100644 --- a/demo/js/Demo.js +++ b/demo/js/Demo.js @@ -7,8 +7,64 @@ */ (function() { + var examples = [ + { name: 'Air Friction', id: 'airFriction' }, + { name: 'Avalanche', id: 'avalanche' }, + { name: 'Ball Pool', id: 'ballPool' }, + { name: 'Bridge', id: 'bridge' }, + { name: 'Broadphase', id: 'broadphase' }, + { name: 'Car', id: 'car' }, + { name: 'Catapult', id: 'catapult' }, + { name: 'Chains', id: 'chains' }, + { name: 'Circle Stack', id: 'circleStack' }, + { name: 'Cloth', id: 'cloth' }, + { name: 'Collision Filtering', id: 'collisionFiltering' }, + { name: 'Composite Manipulation', id: 'compositeManipulation' }, + { name: 'Compound Bodies', id: 'compound' }, + { name: 'Compound Stack', id: 'compoundStack' }, + { name: 'Concave', id: 'concave' }, + { name: 'Constraints', id: 'constraints' }, + { name: 'Double Pendulum', id: 'doublePendulum' }, + { name: 'Events', id: 'events' }, + { name: 'Friction', id: 'friction' }, + { name: 'Reverse Gravity', id: 'gravity' }, + { name: 'Gyroscope', id: 'gyro' }, + { name: 'Manipulation', id: 'manipulation' }, + { name: 'Mixed Shapes', id: 'mixed' }, + { name: 'Newton\'s Cradle', id: 'newtonsCradle' }, + { name: 'Ragdoll', id: 'ragdoll' }, + { name: 'Pyramid', id: 'pyramid' }, + { name: 'Raycasting', id: 'raycasting' }, + { name: 'Restitution', id: 'restitution' }, + { name: 'Rounded Corners (Chamfering)', id: 'rounded' }, + { name: 'Sensors', id: 'sensors' }, + { name: 'Sleeping', id: 'sleeping' }, + { name: 'Slingshot', id: 'slingshot' }, + { name: 'Soft Body', id: 'softBody' }, + { name: 'Sprites', id: 'sprites' }, + { name: 'Stack', id: 'stack' }, + { name: 'Static Friction', id: 'staticFriction' }, + { name: 'Stress', id: 'stress' }, + { name: 'Stress 2', id: 'stress2' }, + { name: 'Concave SVG Paths', id: 'svg' }, + { name: 'Terrain', id: 'terrain' }, + { name: 'Time Scaling', id: 'timescale' }, + { name: 'Views', id: 'views' }, + { name: 'Wrecking Ball', id: 'wreckingBall' } + ]; + var sourceLinkRoot = 'https://github.com/liabru/matter-js/blob/master/examples'; + for (var i = 0; i < examples.length; i += 1) { + var example = examples[i]; + example.sourceLink = sourceLinkRoot + '/' + example.id + '.js'; + example.init = window.Example[example.id]; + + if (!example.init) { + console.warn('Example not loaded:', example.id); + } + } + var demo = MatterTools.Demo.create({ toolbar: { title: 'matter-js', @@ -29,266 +85,7 @@ resetOnOrientation: true, routing: true, startExample: 'mixed', - examples: [ - { - name: 'Air Friction', - id: 'airFriction', - init: Example.airFriction, - sourceLink: sourceLinkRoot + '/airFriction.js' - }, - { - name: 'Avalanche', - id: 'avalanche', - init: Example.avalanche, - sourceLink: sourceLinkRoot + '/avalanche.js' - }, - { - name: 'Ball Pool', - id: 'ballPool', - init: Example.ballPool, - sourceLink: sourceLinkRoot + '/ballPool.js' - }, - { - name: 'Bridge', - id: 'bridge', - init: Example.bridge, - sourceLink: sourceLinkRoot + '/bridge.js' - }, - { - name: 'Broadphase', - id: 'broadphase', - init: Example.broadphase, - sourceLink: sourceLinkRoot + '/broadphase.js' - }, - { - name: 'Car', - id: 'car', - init: Example.car, - sourceLink: sourceLinkRoot + '/car.js' - }, - { - name: 'Catapult', - id: 'catapult', - init: Example.catapult, - sourceLink: sourceLinkRoot + '/catapult.js' - }, - { - name: 'Chains', - id: 'chains', - init: Example.chains, - sourceLink: sourceLinkRoot + '/chains.js' - }, - { - name: 'Circle Stack', - id: 'circleStack', - init: Example.circleStack, - sourceLink: sourceLinkRoot + '/circleStack.js' - }, - { - name: 'Cloth', - id: 'cloth', - init: Example.cloth, - sourceLink: sourceLinkRoot + '/cloth.js' - }, - { - name: 'Collision Filtering', - id: 'collisionFiltering', - init: Example.collisionFiltering, - sourceLink: sourceLinkRoot + '/collisionFiltering.js' - }, - { - name: 'Composite Manipulation', - id: 'compositeManipulation', - init: Example.compositeManipulation, - sourceLink: sourceLinkRoot + '/compositeManipulation.js' - }, - { - name: 'Compound Bodies', - id: 'compound', - init: Example.compound, - sourceLink: sourceLinkRoot + '/compound.js' - }, - { - name: 'Compound Stack', - id: 'compoundStack', - init: Example.compoundStack, - sourceLink: sourceLinkRoot + '/compoundStack.js' - }, - { - name: 'Concave', - id: 'concave', - init: Example.concave, - sourceLink: sourceLinkRoot + '/concave.js' - }, - { - name: 'Constraints', - id: 'constraints', - init: Example.constraints, - sourceLink: sourceLinkRoot + '/constraints.js' - }, - { - name: 'Double Pendulum', - id: 'doublePendulum', - init: Example.doublePendulum, - sourceLink: sourceLinkRoot + '/doublePendulum.js' - }, - { - name: 'Events', - id: 'events', - init: Example.events, - sourceLink: sourceLinkRoot + '/events.js' - }, - { - name: 'Friction', - id: 'friction', - init: Example.friction, - sourceLink: sourceLinkRoot + '/friction.js' - }, - { - name: 'Reverse Gravity', - id: 'gravity', - init: Example.gravity, - sourceLink: sourceLinkRoot + '/gravity.js' - }, - { - name: 'Gyroscope', - id: 'gyro', - init: Example.gyro, - sourceLink: sourceLinkRoot + '/gyro.js' - }, - { - name: 'Manipulation', - id: 'manipulation', - init: Example.manipulation, - sourceLink: sourceLinkRoot + '/manipulation.js' - }, - { - name: 'Mixed Shapes', - id: 'mixed', - init: Example.mixed, - sourceLink: sourceLinkRoot + '/mixed.js' - }, - { - name: 'Newton\'s Cradle', - id: 'newtonsCradle', - init: Example.newtonsCradle, - sourceLink: sourceLinkRoot + '/newtonsCradle.js' - }, - { - name: 'Ragdoll', - id: 'ragdoll', - init: Example.ragdoll, - sourceLink: sourceLinkRoot + '/ragdoll.js' - }, - { - name: 'Pyramid', - id: 'pyramid', - init: Example.pyramid, - sourceLink: sourceLinkRoot + '/pyramid.js' - }, - { - name: 'Raycasting', - id: 'raycasting', - init: Example.raycasting, - sourceLink: sourceLinkRoot + '/raycasting.js' - }, - { - name: 'Restitution', - id: 'restitution', - init: Example.restitution, - sourceLink: sourceLinkRoot + '/restitution.js' - }, - { - name: 'Rounded Corners (Chamfering)', - id: 'rounded', - init: Example.rounded, - sourceLink: sourceLinkRoot + '/rounded.js' - }, - { - name: 'Sensors', - id: 'sensors', - init: Example.sensors, - sourceLink: sourceLinkRoot + '/sensors.js' - }, - { - name: 'Sleeping', - id: 'sleeping', - init: Example.sleeping, - sourceLink: sourceLinkRoot + '/sleeping.js' - }, - { - name: 'Slingshot', - id: 'slingshot', - init: Example.slingshot, - sourceLink: sourceLinkRoot + '/slingshot.js' - }, - { - name: 'Soft Body', - id: 'softBody', - init: Example.softBody, - sourceLink: sourceLinkRoot + '/softBody.js' - }, - { - name: 'Sprites', - id: 'sprites', - init: Example.sprites, - sourceLink: sourceLinkRoot + '/sprites.js' - }, - { - name: 'Stack', - id: 'stack', - init: Example.stack, - sourceLink: sourceLinkRoot + '/stack.js' - }, - { - name: 'Static Friction', - id: 'staticFriction', - init: Example.staticFriction, - sourceLink: sourceLinkRoot + '/staticFriction.js' - }, - { - name: 'Stress', - id: 'stress', - init: Example.stress, - sourceLink: sourceLinkRoot + '/stress.js' - }, - { - name: 'Stress 2', - id: 'stress2', - init: Example.stress2, - sourceLink: sourceLinkRoot + '/stress2.js' - }, - { - name: 'Concave SVG Paths', - id: 'svg', - init: Example.svg, - sourceLink: sourceLinkRoot + '/svg.js' - }, - { - name: 'Terrain', - id: 'terrain', - init: Example.terrain, - sourceLink: sourceLinkRoot + '/terrain.js' - }, - { - name: 'Time Scaling', - id: 'timescale', - init: Example.timescale, - sourceLink: sourceLinkRoot + '/timescale.js' - }, - { - name: 'Views', - id: 'views', - init: Example.views, - sourceLink: sourceLinkRoot + '/views.js' - }, - { - name: 'Wrecking Ball', - id: 'wreckingBall', - init: Example.wreckingBall, - sourceLink: sourceLinkRoot + '/wreckingBall.js' - } - ] + examples: examples }); document.body.appendChild(demo.dom.root); diff --git a/examples/airFriction.js b/examples/airFriction.js index bcac6ff..c943b0e 100644 --- a/examples/airFriction.js +++ b/examples/airFriction.js @@ -80,6 +80,6 @@ Example.airFriction = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/avalanche.js b/examples/avalanche.js index 053387f..0c4465c 100644 --- a/examples/avalanche.js +++ b/examples/avalanche.js @@ -91,6 +91,6 @@ Example.avalanche = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/ballPool.js b/examples/ballPool.js index 252873f..9de47fb 100644 --- a/examples/ballPool.js +++ b/examples/ballPool.js @@ -99,6 +99,6 @@ Example.ballPool = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/bridge.js b/examples/bridge.js index 7e9ca5f..d15777f 100644 --- a/examples/bridge.js +++ b/examples/bridge.js @@ -124,6 +124,6 @@ Example.bridge = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/broadphase.js b/examples/broadphase.js index 87ca466..82d0048 100644 --- a/examples/broadphase.js +++ b/examples/broadphase.js @@ -95,6 +95,6 @@ Example.broadphase = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/car.js b/examples/car.js index 7aa56a5..597ae01 100644 --- a/examples/car.js +++ b/examples/car.js @@ -89,6 +89,6 @@ Example.car = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/catapult.js b/examples/catapult.js index f982be7..e58edad 100644 --- a/examples/catapult.js +++ b/examples/catapult.js @@ -96,6 +96,6 @@ Example.catapult = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/chains.js b/examples/chains.js index fe6aae1..6c150e5 100644 --- a/examples/chains.js +++ b/examples/chains.js @@ -122,6 +122,6 @@ Example.chains = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/circleStack.js b/examples/circleStack.js index cbc9917..95a396d 100644 --- a/examples/circleStack.js +++ b/examples/circleStack.js @@ -81,6 +81,6 @@ Example.circleStack = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/cloth.js b/examples/cloth.js index 1fa521b..10d4066 100644 --- a/examples/cloth.js +++ b/examples/cloth.js @@ -84,6 +84,6 @@ Example.cloth = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/collisionFiltering.js b/examples/collisionFiltering.js index 9671782..f1f2e2f 100644 --- a/examples/collisionFiltering.js +++ b/examples/collisionFiltering.js @@ -155,6 +155,6 @@ Example.collisionFiltering = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/compositeManipulation.js b/examples/compositeManipulation.js index aa30114..5058b45 100644 --- a/examples/compositeManipulation.js +++ b/examples/compositeManipulation.js @@ -107,6 +107,6 @@ Example.compositeManipulation = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/compound.js b/examples/compound.js index 5cbb8b3..e6a0bdf 100644 --- a/examples/compound.js +++ b/examples/compound.js @@ -106,6 +106,6 @@ Example.compound = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/compoundStack.js b/examples/compoundStack.js index f5ff325..66c2020 100644 --- a/examples/compoundStack.js +++ b/examples/compoundStack.js @@ -89,6 +89,6 @@ Example.compoundStack = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/concave.js b/examples/concave.js index c7acf86..0a25135 100644 --- a/examples/concave.js +++ b/examples/concave.js @@ -95,6 +95,6 @@ Example.concave = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/constraints.js b/examples/constraints.js index 653033f..1255607 100644 --- a/examples/constraints.js +++ b/examples/constraints.js @@ -179,6 +179,6 @@ Example.constraints = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/doublePendulum.js b/examples/doublePendulum.js index b5744ea..a847bdb 100644 --- a/examples/doublePendulum.js +++ b/examples/doublePendulum.js @@ -152,6 +152,6 @@ Example.doublePendulum = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/events.js b/examples/events.js index cad6e18..0ebfd0e 100644 --- a/examples/events.js +++ b/examples/events.js @@ -178,6 +178,6 @@ Example.events = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/friction.js b/examples/friction.js index e4a3d24..1284b73 100644 --- a/examples/friction.js +++ b/examples/friction.js @@ -90,6 +90,6 @@ Example.friction = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/gravity.js b/examples/gravity.js index 5266645..1018564 100644 --- a/examples/gravity.js +++ b/examples/gravity.js @@ -96,6 +96,6 @@ Example.gravity = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/gyro.js b/examples/gyro.js index 364ef7a..8b93a77 100644 --- a/examples/gyro.js +++ b/examples/gyro.js @@ -130,6 +130,6 @@ Example.gyro = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/manipulation.js b/examples/manipulation.js index ff56ee6..f69eb81 100644 --- a/examples/manipulation.js +++ b/examples/manipulation.js @@ -140,6 +140,6 @@ Example.manipulation = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/mixed.js b/examples/mixed.js index d5288c5..8784b3e 100644 --- a/examples/mixed.js +++ b/examples/mixed.js @@ -105,6 +105,6 @@ Example.mixed = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/newtonsCradle.js b/examples/newtonsCradle.js index dd24864..00b2f42 100644 --- a/examples/newtonsCradle.js +++ b/examples/newtonsCradle.js @@ -76,6 +76,6 @@ Example.newtonsCradle = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/pyramid.js b/examples/pyramid.js index ba4fc54..66dbe6b 100644 --- a/examples/pyramid.js +++ b/examples/pyramid.js @@ -81,6 +81,6 @@ Example.pyramid = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/ragdoll.js b/examples/ragdoll.js index df12bb9..1a717f8 100644 --- a/examples/ragdoll.js +++ b/examples/ragdoll.js @@ -497,6 +497,6 @@ Example.ragdoll.ragdoll = function(x, y, scale, options) { return person; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/raycasting.js b/examples/raycasting.js index 6e37414..883434a 100644 --- a/examples/raycasting.js +++ b/examples/raycasting.js @@ -135,6 +135,6 @@ Example.raycasting = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/restitution.js b/examples/restitution.js index e72d56c..86ad286 100644 --- a/examples/restitution.js +++ b/examples/restitution.js @@ -85,6 +85,6 @@ Example.restitution = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/rounded.js b/examples/rounded.js index 81ddc28..d4dc144 100644 --- a/examples/rounded.js +++ b/examples/rounded.js @@ -109,6 +109,6 @@ Example.rounded = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/sensors.js b/examples/sensors.js index 6b0c36f..ff92caa 100644 --- a/examples/sensors.js +++ b/examples/sensors.js @@ -131,6 +131,6 @@ Example.sensors = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/sleeping.js b/examples/sleeping.js index 847875a..147eb5d 100644 --- a/examples/sleeping.js +++ b/examples/sleeping.js @@ -104,6 +104,6 @@ Example.sleeping = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/slingshot.js b/examples/slingshot.js index 0f9b995..49344e1 100644 --- a/examples/slingshot.js +++ b/examples/slingshot.js @@ -100,6 +100,6 @@ Example.slingshot = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/softBody.js b/examples/softBody.js index 0ad3ff0..81b8eb7 100644 --- a/examples/softBody.js +++ b/examples/softBody.js @@ -85,6 +85,6 @@ Example.softBody = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/sprites.js b/examples/sprites.js index 9fa0b47..7c6bee8 100644 --- a/examples/sprites.js +++ b/examples/sprites.js @@ -113,6 +113,6 @@ Example.sprites = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/stack.js b/examples/stack.js index 8d69533..fc198d9 100644 --- a/examples/stack.js +++ b/examples/stack.js @@ -81,6 +81,6 @@ Example.stack = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/staticFriction.js b/examples/staticFriction.js index 4dfb13a..adc9d4d 100644 --- a/examples/staticFriction.js +++ b/examples/staticFriction.js @@ -106,6 +106,6 @@ Example.staticFriction = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/stress.js b/examples/stress.js index 9d08c57..eb4ff3e 100644 --- a/examples/stress.js +++ b/examples/stress.js @@ -79,6 +79,6 @@ Example.stress = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/stress2.js b/examples/stress2.js index af4f937..e2c46e7 100644 --- a/examples/stress2.js +++ b/examples/stress2.js @@ -79,6 +79,6 @@ Example.stress2 = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/svg.js b/examples/svg.js index be191a4..4569576 100644 --- a/examples/svg.js +++ b/examples/svg.js @@ -124,6 +124,6 @@ Example.svg = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/terrain.js b/examples/terrain.js index bd69413..305be07 100644 --- a/examples/terrain.js +++ b/examples/terrain.js @@ -105,6 +105,6 @@ Example.terrain = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example; } \ No newline at end of file diff --git a/examples/timescale.js b/examples/timescale.js index 86509c7..7274924 100644 --- a/examples/timescale.js +++ b/examples/timescale.js @@ -151,6 +151,6 @@ Example.timescale = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/views.js b/examples/views.js index e4afd75..0d5cdfd 100644 --- a/examples/views.js +++ b/examples/views.js @@ -182,6 +182,6 @@ Example.views = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file diff --git a/examples/wreckingBall.js b/examples/wreckingBall.js index 18aeefe..fd4f1bc 100644 --- a/examples/wreckingBall.js +++ b/examples/wreckingBall.js @@ -93,6 +93,6 @@ Example.wreckingBall = function() { }; }; -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== 'undefined') { module.exports = Example[Object.keys(Example)[0]]; } \ No newline at end of file