├── docs ├── _config.yml ├── red.52be5f17.png ├── space.f9604c1b.png ├── favicon-16x16.c185778f.png ├── favicon-32x32.3df3657b.png ├── apple-touch-icon.968a9f06.png ├── android-chrome-192x192.678466e6.png ├── android-chrome-256x256.29e071d4.png ├── meta │ └── site.webmanifest ├── safari-pinned-tab.ead9fee4.svg └── index.html ├── .nvmrc ├── .babelrc ├── sandbox.config.json ├── .gitignore ├── src ├── assets │ ├── red.png │ └── space.png ├── meta │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── apple-touch-icon.png │ ├── android-chrome-192x192.png │ ├── android-chrome-256x256.png │ ├── android-chrome-512x512.png │ ├── site.webmanifest │ └── safari-pinned-tab.svg ├── main.ts ├── gameConfig.ts ├── scenes │ ├── EndScene.ts │ ├── MenuScene.ts │ ├── BootScene.ts │ └── PlayScene.ts └── index.html ├── dist ├── red.5c208bbd.png ├── space.89e3a46b.png ├── favicon-16x16.fcfde30b.png ├── favicon-32x32.1c961af8.png ├── apple-touch-icon.8083eab7.png ├── android-chrome-192x192.793ee286.png ├── android-chrome-256x256.52cdbd65.png ├── meta │ └── site.webmanifest ├── safari-pinned-tab.a65600d3.svg ├── index.html ├── index.js └── index.js.map ├── .eslintrc.yml ├── Makefile ├── .editorconfig ├── README.md └── package.json /docs/_config.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v12.19.0 2 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } -------------------------------------------------------------------------------- /sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "parcel" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.cache 2 | /package-lock.json 3 | node_modules/ 4 | yarn.lock 5 | -------------------------------------------------------------------------------- /src/assets/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/assets/red.png -------------------------------------------------------------------------------- /dist/red.5c208bbd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/dist/red.5c208bbd.png -------------------------------------------------------------------------------- /docs/red.52be5f17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/docs/red.52be5f17.png -------------------------------------------------------------------------------- /src/assets/space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/assets/space.png -------------------------------------------------------------------------------- /src/meta/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/meta/favicon.ico -------------------------------------------------------------------------------- /dist/space.89e3a46b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/dist/space.89e3a46b.png -------------------------------------------------------------------------------- /docs/space.f9604c1b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/docs/space.f9604c1b.png -------------------------------------------------------------------------------- /src/meta/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/meta/favicon-16x16.png -------------------------------------------------------------------------------- /src/meta/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/meta/favicon-32x32.png -------------------------------------------------------------------------------- /src/meta/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/meta/apple-touch-icon.png -------------------------------------------------------------------------------- /dist/favicon-16x16.fcfde30b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/dist/favicon-16x16.fcfde30b.png -------------------------------------------------------------------------------- /dist/favicon-32x32.1c961af8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/dist/favicon-32x32.1c961af8.png -------------------------------------------------------------------------------- /docs/favicon-16x16.c185778f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/docs/favicon-16x16.c185778f.png -------------------------------------------------------------------------------- /docs/favicon-32x32.3df3657b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/docs/favicon-32x32.3df3657b.png -------------------------------------------------------------------------------- /dist/apple-touch-icon.8083eab7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/dist/apple-touch-icon.8083eab7.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.968a9f06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/docs/apple-touch-icon.968a9f06.png -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | extends: semistandard 2 | env: 3 | browser: true 4 | es6: true 5 | parserOptions: 6 | sourceType: module 7 | -------------------------------------------------------------------------------- /src/meta/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/meta/android-chrome-192x192.png -------------------------------------------------------------------------------- /src/meta/android-chrome-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/meta/android-chrome-256x256.png -------------------------------------------------------------------------------- /src/meta/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/src/meta/android-chrome-512x512.png -------------------------------------------------------------------------------- /dist/android-chrome-192x192.793ee286.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/dist/android-chrome-192x192.793ee286.png -------------------------------------------------------------------------------- /dist/android-chrome-256x256.52cdbd65.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/dist/android-chrome-256x256.52cdbd65.png -------------------------------------------------------------------------------- /docs/android-chrome-192x192.678466e6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/docs/android-chrome-192x192.678466e6.png -------------------------------------------------------------------------------- /docs/android-chrome-256x256.29e071d4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanuys/mathsgame/master/docs/android-chrome-256x256.29e071d4.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: run dist test 2 | 3 | dist: 4 | rm -rf docs/ 5 | mkdir -p docs 6 | touch docs/_config.yml 7 | npm run dist 8 | 9 | run: 10 | npm run start 11 | 12 | test: 13 | npm run test 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [{src,scripts}/**.{ts,json,js}] 4 | end_of_line = crlf 5 | charset = utf-8 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | indent_style = space 9 | indent_size = 4 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Get started 2 | 3 | npm install -g parcel-bundler 4 | 5 | Auto-compile and run dev server 6 | Parcel will also install deps with yarn. 7 | 8 | make run 9 | 10 | Compile for production 11 | 12 | make dist 13 | 14 | -------------------------------------------------------------------------------- /dist/meta/site.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"","short_name":"","icons":[{"src":"android-chrome-192x192.793ee286.png","sizes":"192x192","type":"image/png"},{"src":"android-chrome-256x256.52cdbd65.png","sizes":"256x256","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} -------------------------------------------------------------------------------- /docs/meta/site.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"","short_name":"","icons":[{"src":"android-chrome-192x192.678466e6.png","sizes":"192x192","type":"image/png"},{"src":"android-chrome-256x256.29e071d4.png","sizes":"256x256","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import Phaser from 'phaser' 2 | import gameConfig from './gameConfig' 3 | 4 | function newGame () { 5 | if (game) return 6 | game = new Phaser.Game(gameConfig) 7 | } 8 | 9 | function destroyGame () { 10 | if (!game) return 11 | game.destroy(true) 12 | game.runDestroy() 13 | game = null 14 | } 15 | 16 | let game 17 | 18 | if (module.hot) { 19 | module.hot.dispose(destroyGame) 20 | module.hot.accept(newGame) 21 | } 22 | 23 | if (!game) newGame() 24 | -------------------------------------------------------------------------------- /src/meta/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "short_name": "", 4 | "icons": [ 5 | { 6 | "src": "/meta/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/meta/android-chrome-256x256.png", 12 | "sizes": "256x256", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /src/gameConfig.ts: -------------------------------------------------------------------------------- 1 | import Phaser from 'phaser'; 2 | import BootScene from './scenes/BootScene'; 3 | import PlayScene from './scenes/PlayScene'; 4 | import MenuScene from './scenes/MenuScene'; 5 | import EndScene from './scenes/EndScene'; 6 | 7 | export default { 8 | type: Phaser.AUTO, 9 | width: 800, 10 | height: 600, 11 | title: 'Quick maths game', 12 | url: 'https://github.com/opyate/phaser-parcel', 13 | banner: { text: 'white', background: ['#FD7400', '#FFE11A', '#BEDB39', '#1F8A70', '#004358'] }, 14 | scene: [BootScene, MenuScene, PlayScene, EndScene] 15 | }; 16 | -------------------------------------------------------------------------------- /src/scenes/EndScene.ts: -------------------------------------------------------------------------------- 1 | import Phaser from 'phaser' 2 | 3 | export default class EndScene extends Phaser.Scene { 4 | constructor () { 5 | super({ key: 'end' }) 6 | } 7 | 8 | create () { 9 | this.add.image(400, 300, 'space') 10 | 11 | this.add.text(400, 200, 'Game Over\n\n< menu >', { 12 | align: 'center', 13 | fill: 'white', 14 | fontFamily: 'sans-serif', 15 | fontSize: 48, 16 | }) 17 | .setOrigin(0.5, 0) 18 | 19 | this.input.on('pointerdown', function () { 20 | this.scene.switch('menu') 21 | }, this) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/scenes/MenuScene.ts: -------------------------------------------------------------------------------- 1 | import Phaser from 'phaser' 2 | 3 | export default class MenuScene extends Phaser.Scene { 4 | constructor () { 5 | super({ key: 'menu' }) 6 | } 7 | 8 | create () { 9 | // background 10 | this.add.image(400, 300, 'space') 11 | 12 | this.add.text(400, 200, 'A quick maths game\n\n< play >', { 13 | align: 'center', 14 | fill: 'white', 15 | fontFamily: 'sans-serif', 16 | fontSize: 48, 17 | }) 18 | .setOrigin(0.5, 0) 19 | 20 | this.input.on('pointerdown', function () { 21 | this.scene.switch('play') 22 | }, this) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/scenes/BootScene.ts: -------------------------------------------------------------------------------- 1 | import Phaser from 'phaser' 2 | // @ts-ignore 3 | import images from '../assets/*.png' 4 | 5 | export default class BootScene extends Phaser.Scene { 6 | constructor () { 7 | super({ key: 'boot' }) 8 | } 9 | 10 | preload () { 11 | const bg = this.add.rectangle(400, 300, 400, 30, 0x666666) 12 | const bar = this.add.rectangle(bg.x, bg.y, bg.width, bg.height, 0xffffff).setScale(0, 1) 13 | 14 | console.table(images) 15 | 16 | this.load.image('space', images.space) 17 | this.load.image('red', images.red) 18 | 19 | this.load.on('progress', function (progress) { 20 | bar.setScale(progress, 1) 21 | }) 22 | } 23 | 24 | update () { 25 | this.scene.start('menu') 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phaser-parcel", 3 | "version": "1.0.0", 4 | "description": "A Phaser 3 game template using Parcel bundler", 5 | "main": "src/index.html", 6 | "scripts": { 7 | "dist": "parcel build src/index.html -d docs --public-url ./", 8 | "start": "parcel serve src/index.html", 9 | "clean": "rm -rfv dist && rm -rf .cache", 10 | "test": "jest --watch" 11 | }, 12 | "keywords": [ 13 | "phaser", 14 | "phaser3", 15 | "phaser-boilerplate" 16 | ], 17 | "author": "opyate", 18 | "license": "NONE", 19 | "dependencies": { 20 | "lodash": "^4.17.20", 21 | "phaser": "^3.24.1" 22 | }, 23 | "devDependencies": { 24 | "@babel/core": "^7.12.0", 25 | "@babel/preset-env": "^7.12.0", 26 | "cssnano": "^4.1.10", 27 | "eslint": "^5.16.0", 28 | "eslint-config-semistandard": "^13.0.0", 29 | "eslint-config-standard": "^12.0.0", 30 | "eslint-plugin-import": "^2.17.3", 31 | "eslint-plugin-node": "^8.0.1", 32 | "eslint-plugin-promise": "^4.1.1", 33 | "eslint-plugin-standard": "^4.0.0", 34 | "typescript": "^4.0.3" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/meta/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 17 | 19 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /dist/safari-pinned-tab.a65600d3.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 17 | 19 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/safari-pinned-tab.ead9fee4.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 17 | 19 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | Quick maths game 2 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Quick maths game 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Quick maths game 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/scenes/PlayScene.ts: -------------------------------------------------------------------------------- 1 | import Phaser from 'phaser' 2 | import _ from 'lodash' 3 | 4 | export default class PlayScene extends Phaser.Scene { 5 | constructor () { 6 | super({ 7 | key: 'play', 8 | physics: { 9 | arcade: { 10 | gravity: { y: 300 }, 11 | debug: false, 12 | }, 13 | } 14 | }) 15 | this.gameObjects = [] 16 | } 17 | 18 | randomIntFromInterval(min, max) { // min and max included 19 | return Math.floor(Math.random() * (max - min + 1) + min); 20 | } 21 | 22 | onClick(pointer) { 23 | this.text.input.enable = false 24 | 25 | const result = parseInt(this.text.text) === this.answer 26 | console.log(result) 27 | if (result) { 28 | // make everything go away 29 | this.self.gameObjects.forEach(go => { 30 | go.emit('byebye') 31 | }) 32 | 33 | // give the player some positive feedback 34 | const emitter = this.self.add.particles('red') 35 | .createEmitter({ 36 | speed: 100, 37 | scale: { start: 1, end: 0 }, 38 | blendMode: 'ADD', 39 | }) 40 | emitter.startFollow(this.text) 41 | 42 | var timer = this.self.time.delayedCall(500, function () { 43 | this.self.scene.restart() 44 | }, [], this) 45 | 46 | 47 | } else { 48 | this.self.scene.stop().run('end') 49 | } 50 | 51 | } 52 | 53 | byeBye() { 54 | console.log("removing text from scene", this.text) 55 | this.text.visible = false 56 | } 57 | 58 | addChallenge() { 59 | var self = this 60 | 61 | const x = this.randomIntFromInterval(1, 12).toString() 62 | const y = this.randomIntFromInterval(1, 12).toString() 63 | const items = [x , '*', y, '=', '?'] 64 | const answer = eval(items.slice(0,3).join(' ')) 65 | const isEven = answer % 2 === 0 66 | 67 | items.forEach((item, idx) => { 68 | const text = this.add.text(200 + (idx * 100), 100, item, { 69 | align: 'center', 70 | fill: 'white', 71 | fontFamily: 'sans-serif', 72 | fontSize: 48, 73 | }) 74 | .setOrigin(0.5, 0) 75 | 76 | text.on('byebye', this.byeBye, { text }) 77 | this.gameObjects.push(text) 78 | }) 79 | 80 | let answers = [] 81 | if (isEven) { 82 | answers = [answer - 2, answer, answer + 2] 83 | } else { 84 | answers = [answer - 1, answer, answer + 1] 85 | } 86 | answers = _.shuffle(answers) 87 | 88 | answers.forEach((item, idx) => { 89 | const text = this.add.text(300 + (idx * 100), 300, item, { 90 | align: 'center', 91 | fill: 'white', 92 | fontFamily: 'sans-serif', 93 | fontSize: 48, 94 | }) 95 | .setOrigin(0.5, 0) 96 | 97 | text.setInteractive(new Phaser.Geom.Rectangle(0, 0, text.width, text.height), Phaser.Geom.Rectangle.Contains) 98 | text.on('pointerdown', this.onClick, { text, answer, self }) 99 | this.gameObjects.push(text) 100 | }) 101 | 102 | } 103 | 104 | create () { 105 | // background 106 | this.add.image(400, 300, 'space') 107 | 108 | this.addChallenge() 109 | 110 | this.input.keyboard 111 | .on('keydown-R', function () { 112 | this.scene.restart() 113 | }, this) 114 | .on('keydown-Q', function () { 115 | this.scene.stop().run('menu') 116 | }, this) 117 | .on('keydown-K', function () { 118 | this.scene.stop().run('end') 119 | }, this) 120 | } 121 | 122 | update () {} 123 | } 124 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | // modules are defined as an array 2 | // [ module function, map of requires ] 3 | // 4 | // map of requires is short require name -> numeric require 5 | // 6 | // anything defined in a previous bundle is accessed via the 7 | // orig method which is the require for previous bundles 8 | parcelRequire = (function (modules, cache, entry, globalName) { 9 | // Save the require from previous bundle to this closure if any 10 | var previousRequire = typeof parcelRequire === 'function' && parcelRequire; 11 | var nodeRequire = typeof require === 'function' && require; 12 | 13 | function newRequire(name, jumped) { 14 | if (!cache[name]) { 15 | if (!modules[name]) { 16 | // if we cannot find the module within our internal map or 17 | // cache jump to the current global require ie. the last bundle 18 | // that was added to the page. 19 | var currentRequire = typeof parcelRequire === 'function' && parcelRequire; 20 | if (!jumped && currentRequire) { 21 | return currentRequire(name, true); 22 | } 23 | 24 | // If there are other bundles on this page the require from the 25 | // previous one is saved to 'previousRequire'. Repeat this as 26 | // many times as there are bundles until the module is found or 27 | // we exhaust the require chain. 28 | if (previousRequire) { 29 | return previousRequire(name, true); 30 | } 31 | 32 | // Try the node require function if it exists. 33 | if (nodeRequire && typeof name === 'string') { 34 | return nodeRequire(name); 35 | } 36 | 37 | var err = new Error('Cannot find module \'' + name + '\''); 38 | err.code = 'MODULE_NOT_FOUND'; 39 | throw err; 40 | } 41 | 42 | localRequire.resolve = resolve; 43 | localRequire.cache = {}; 44 | 45 | var module = cache[name] = new newRequire.Module(name); 46 | 47 | modules[name][0].call(module.exports, localRequire, module, module.exports, this); 48 | } 49 | 50 | return cache[name].exports; 51 | 52 | function localRequire(x){ 53 | return newRequire(localRequire.resolve(x)); 54 | } 55 | 56 | function resolve(x){ 57 | return modules[name][1][x] || x; 58 | } 59 | } 60 | 61 | function Module(moduleName) { 62 | this.id = moduleName; 63 | this.bundle = newRequire; 64 | this.exports = {}; 65 | } 66 | 67 | newRequire.isParcelRequire = true; 68 | newRequire.Module = Module; 69 | newRequire.modules = modules; 70 | newRequire.cache = cache; 71 | newRequire.parent = previousRequire; 72 | newRequire.register = function (id, exports) { 73 | modules[id] = [function (require, module) { 74 | module.exports = exports; 75 | }, {}]; 76 | }; 77 | 78 | var error; 79 | for (var i = 0; i < entry.length; i++) { 80 | try { 81 | newRequire(entry[i]); 82 | } catch (e) { 83 | // Save first error but execute all entries 84 | if (!error) { 85 | error = e; 86 | } 87 | } 88 | } 89 | 90 | if (entry.length) { 91 | // Expose entry point to Node, AMD or browser globals 92 | // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js 93 | var mainExports = newRequire(entry[entry.length - 1]); 94 | 95 | // CommonJS 96 | if (typeof exports === "object" && typeof module !== "undefined") { 97 | module.exports = mainExports; 98 | 99 | // RequireJS 100 | } else if (typeof define === "function" && define.amd) { 101 | define(function () { 102 | return mainExports; 103 | }); 104 | 105 | //