1
0
Fork 0

Shorthand method definitions

babel
Mike Gerwitz 2015-12-24 00:42:24 -05:00
parent a731325461
commit c9df9f439e
18 changed files with 173 additions and 173 deletions

View File

@ -42,43 +42,43 @@ module.exports = Class( 'ClassicGame' )
* LTG loader * LTG loader
* @type {LtgLoader} * @type {LtgLoader}
*/ */
'private _ltgLoader': null, _ltgLoader: null,
/** /**
* Tile masker * Tile masker
* @type {TileMasker} * @type {TileMasker}
*/ */
'private _masker': null, _masker: null,
/** /**
* Tiles * Tiles
* @type {Object.<Object>} * @type {Object.<Object>}
*/ */
'private _tileSet': null, _tileSet: null,
/** /**
* Set of available levels * Set of available levels
* @type {LevelSet} * @type {LevelSet}
*/ */
'private _levelSet': null, _levelSet: null,
/** /**
* Event handlers * Event handlers
* @type {Object.<Function>} * @type {Object.<Function>}
*/ */
'private _callback': {}, _callback: {},
/** /**
* Performs level rendering * Performs level rendering
* @type {LevelRender} * @type {LevelRender}
*/ */
'private _render': null, _render: null,
/** /**
* Classic game object factory * Classic game object factory
* @type {ClassicGameObjectFactory} * @type {ClassicGameObjectFactory}
*/ */
'private _gameObjFactory': null, _gameObjFactory: null,
/** /**
@ -96,7 +96,7 @@ module.exports = Class( 'ClassicGame' )
* @param {string} ltg_data binary string containing LTG file data * @param {string} ltg_data binary string containing LTG file data
* @param {string} lvl_data binary string containing LVL file data * @param {string} lvl_data binary string containing LVL file data
*/ */
__construct: function( document, ltg_data, lvl_data ) __construct( document, ltg_data, lvl_data )
{ {
const _self = this; const _self = this;
@ -126,7 +126,7 @@ module.exports = Class( 'ClassicGame' )
* *
* @return {ClassicGame} self * @return {ClassicGame} self
*/ */
'public renderTo': function( ctx, event_target ) renderTo( ctx, event_target )
{ {
// if there is a previous renderer, free its canvas before // if there is a previous renderer, free its canvas before
// continuing (to both clean up and to free any locks, allowing for // continuing (to both clean up and to free any locks, allowing for
@ -178,7 +178,7 @@ module.exports = Class( 'ClassicGame' )
* *
* @return {ClassicGame} self * @return {ClassicGame} self
*/ */
'public setTileData': function( data, callback ) setTileData( data, callback )
{ {
// get tile metadata // get tile metadata
const _self = this, const _self = this,
@ -202,7 +202,7 @@ module.exports = Class( 'ClassicGame' )
* *
* @return {ClassicGame} self * @return {ClassicGame} self
*/ */
'public setLevelData': function( data, callback ) setLevelData( data, callback )
{ {
this._levelSet = LevelSet( data, ClassicLevel ); this._levelSet = LevelSet( data, ClassicLevel );
@ -222,7 +222,7 @@ module.exports = Class( 'ClassicGame' )
* *
* @return {ClassicGame} self * @return {ClassicGame} self
*/ */
'public on': function( name, callback ) on( name, callback )
{ {
this._callback[ name ] = callback; this._callback[ name ] = callback;
return this; return this;
@ -236,7 +236,7 @@ module.exports = Class( 'ClassicGame' )
* *
* @return {ClassicGame} self * @return {ClassicGame} self
*/ */
'private _trigger': function( name ) _trigger( name )
{ {
if ( typeof this._callback[ name ] === 'function' ) if ( typeof this._callback[ name ] === 'function' )
{ {

View File

@ -27,22 +27,22 @@ module.exports = Class( 'ClassicGameObjectFactory' )
.implement( GameObjectFactory ) .implement( GameObjectFactory )
.extend( .extend(
{ {
'private _objs': {}, _objs: {},
__construct: function() __construct()
{ {
this._initObjs(); this._initObjs();
}, },
'public createObject': function( id ) createObject( id )
{ {
return ( this._objs[ id ] || GameObject )( id ); return ( this._objs[ id ] || GameObject )( id );
}, },
'private _initObjs': function() _initObjs()
{ {
this._objs = { this._objs = {
dirt: null, dirt: null,

View File

@ -43,7 +43,7 @@ module.exports = Class( 'ClassicTileDfn' )
* *
* @return {Array.<Array.<string,number>>} tile definition * @return {Array.<Array.<string,number>>} tile definition
*/ */
'public getTileDefinition': function() getTileDefinition()
{ {
return [ return [
[ 'dirt', 0 ], /* dirt */ [ 'dirt', 0 ], /* dirt */
@ -121,7 +121,7 @@ module.exports = Class( 'ClassicTileDfn' )
* *
* @return {Array.<number>} tile width, tile height, tiles per row * @return {Array.<number>} tile width, tile height, tiles per row
*/ */
'public getTileDimensions': function() getTileDimensions()
{ {
return [ 32, 32, 10 ]; return [ 32, 32, 10 ];
} }

View File

@ -36,13 +36,13 @@ module.exports = Class( 'FileLoader',
* DOM file element to watch * DOM file element to watch
* @type {HTMLInputElement} * @type {HTMLInputElement}
*/ */
'private _element': null, _element: null,
/** /**
* Callback to call on file load * Callback to call on file load
* @type {function(Error,string)} * @type {function(Error,string)}
*/ */
'private _callback': null, _callback: null,
/** /**
@ -51,7 +51,7 @@ module.exports = Class( 'FileLoader',
* @param {HtmlInputElement} element file element to monitor * @param {HtmlInputElement} element file element to monitor
* @param {FileReader} reader file reader * @param {FileReader} reader file reader
*/ */
__construct: function( element, reader ) __construct( element, reader )
{ {
if ( element.type !== 'file' ) if ( element.type !== 'file' )
{ {
@ -75,7 +75,7 @@ module.exports = Class( 'FileLoader',
* *
* @return {FileLoader} self * @return {FileLoader} self
*/ */
'public onLoad': function( callback ) onLoad( callback )
{ {
this._callback = callback; this._callback = callback;
@ -100,7 +100,7 @@ module.exports = Class( 'FileLoader',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _loadFile': function( event ) _loadFile( event )
{ {
const _self = this, const _self = this,
files = event.target.files; files = event.target.files;

View File

@ -35,7 +35,7 @@ module.exports = Interface( 'Game',
* *
* @return {Game} self * @return {Game} self
*/ */
'public renderTo': [ 'ctx' ], renderTo: [ 'ctx' ],
/** /**
@ -46,7 +46,7 @@ module.exports = Interface( 'Game',
* *
* @return {Game} self * @return {Game} self
*/ */
'public setTileData': [ 'data', 'callback' ], setTileData: [ 'data', 'callback' ],
/** /**
@ -57,7 +57,7 @@ module.exports = Interface( 'Game',
* *
* @return {Game} self * @return {Game} self
*/ */
'public setLevelData': [ 'data', 'callback' ], setLevelData: [ 'data', 'callback' ],
/** /**
@ -71,5 +71,5 @@ module.exports = Interface( 'Game',
* *
* @return {Game} self * @return {Game} self
*/ */
'public on': [ 'name', 'callback' ] on: [ 'name', 'callback' ]
} ); } );

View File

@ -54,17 +54,17 @@ const Class = require( 'easejs' ).Class;
module.exports = Class( 'LtgLoader', module.exports = Class( 'LtgLoader',
{ {
/** various data segment byte offsets and lengths **/ /** various data segment byte offsets and lengths **/
'private const _POS_NAME': [ 0, 40 ], 'const _POS_NAME': [ 0, 40 ],
'private const _POS_AUTHOR': [ 40, 30 ], 'const _POS_AUTHOR': [ 40, 30 ],
'private const _POS_DESC': [ 70, 245 ], 'const _POS_DESC': [ 70, 245 ],
'private const _POS_ID': [ 315, 5 ], 'const _POS_ID': [ 315, 5 ],
'private const _POS_MOFF': [ 320, 4 ], 'const _POS_MOFF': [ 320, 4 ],
/** /**
* Beginning of game bitmap (one byte past the header) * Beginning of game bitmap (one byte past the header)
* @type {number} * @type {number}
*/ */
'private const _OFFSET_HEADER_END': 324, 'const _OFFSET_HEADER_END': 324,
/** /**
@ -74,7 +74,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {Object} LTG metadata and bitmaps (sans mask offset) * @return {Object} LTG metadata and bitmaps (sans mask offset)
*/ */
'public fromString': function( ltg_data ) fromString( ltg_data )
{ {
const mask_offset = this._getMaskOffsetFromData( ltg_data ); const mask_offset = this._getMaskOffsetFromData( ltg_data );
@ -105,7 +105,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} requested segment * @return {string} requested segment
*/ */
'private _getDataSegment': function( ltg_data, sgmt, stripnull ) _getDataSegment( ltg_data, sgmt, stripnull )
{ {
// strip null bytes by default // strip null bytes by default
stripnull = ( stripnull === undefined ) ? true : !!stripnull; stripnull = ( stripnull === undefined ) ? true : !!stripnull;
@ -130,7 +130,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} LTG name, null bytes stripped * @return {string} LTG name, null bytes stripped
*/ */
'private _getNameFromData': function( ltg_data ) _getNameFromData( ltg_data )
{ {
return this._getDataSegment( ltg_data, '_POS_NAME' ); return this._getDataSegment( ltg_data, '_POS_NAME' );
}, },
@ -143,7 +143,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} LTG author, null bytes stripped * @return {string} LTG author, null bytes stripped
*/ */
'private _getAuthorFromData': function( ltg_data ) _getAuthorFromData( ltg_data )
{ {
return this._getDataSegment( ltg_data, '_POS_AUTHOR' ); return this._getDataSegment( ltg_data, '_POS_AUTHOR' );
}, },
@ -156,7 +156,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} LTG description, null bytes stripped * @return {string} LTG description, null bytes stripped
*/ */
'private _getDescFromData': function( ltg_data ) _getDescFromData( ltg_data )
{ {
return this._getDataSegment( ltg_data, '_POS_DESC' ); return this._getDataSegment( ltg_data, '_POS_DESC' );
}, },
@ -169,7 +169,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} LTG id, null bytes stripped * @return {string} LTG id, null bytes stripped
*/ */
'private _getIdFromData': function( ltg_data ) _getIdFromData( ltg_data )
{ {
return this._getDataSegment( ltg_data, '_POS_ID' ); return this._getDataSegment( ltg_data, '_POS_ID' );
}, },
@ -185,7 +185,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {number} LTG mask offset in bytes * @return {number} LTG mask offset in bytes
*/ */
'private _getMaskOffsetFromData': function( ltg_data ) _getMaskOffsetFromData( ltg_data )
{ {
// grab the data and don't bother stripping off the null bytes (it would // grab the data and don't bother stripping off the null bytes (it would
// function the same with them stripped, but let's avoid the confusion // function the same with them stripped, but let's avoid the confusion
@ -217,7 +217,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} data URL corresponding to the given bitmap data * @return {string} data URL corresponding to the given bitmap data
*/ */
'private _getBitmapDataUrl': function( data ) _getBitmapDataUrl( data )
{ {
return 'data:image/bmp;base64,' + btoa( data ); return 'data:image/bmp;base64,' + btoa( data );
}, },
@ -236,7 +236,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} game bitmap data * @return {string} game bitmap data
*/ */
'private _getGameBitmap': function( ltg_data, mask_offset ) _getGameBitmap( ltg_data, mask_offset )
{ {
const bmp_offset = this.__self.$( '_OFFSET_HEADER_END' ); const bmp_offset = this.__self.$( '_OFFSET_HEADER_END' );
@ -256,7 +256,7 @@ module.exports = Class( 'LtgLoader',
* *
* @return {string} mask bitmap data * @return {string} mask bitmap data
*/ */
'private _getMaskBitmap': function( ltg_data, mask_offset ) _getMaskBitmap( ltg_data, mask_offset )
{ {
// the mask bitmap accounts for the remainder of the data // the mask bitmap accounts for the remainder of the data
return ltg_data.substr( mask_offset ); return ltg_data.substr( mask_offset );

View File

@ -103,7 +103,7 @@ module.exports = Interface( 'TileDfn',
* *
* @return {Array.<Array.<string,number>>} tile definition * @return {Array.<Array.<string,number>>} tile definition
*/ */
'public getTileDefinition': [], getTileDefinition: [],
/** /**
@ -115,5 +115,5 @@ module.exports = Interface( 'TileDfn',
* *
* @return {Array.<number>} tile width, tile height, tiles per row * @return {Array.<number>} tile width, tile height, tiles per row
*/ */
'public getTileDimensions': [] getTileDimensions: []
} ); } );

View File

@ -75,49 +75,49 @@ module.exports = Class( 'TileMasker',
* Canvas 2D context (used for masking and tile slicing) * Canvas 2D context (used for masking and tile slicing)
* @type {CanvasRenderingContext2d} * @type {CanvasRenderingContext2d}
*/ */
'private _context': null, _context: null,
/** /**
* DOM document * DOM document
* @type {HTMLDocument} * @type {HTMLDocument}
*/ */
'private _document': null, _document: null,
/** /**
* Tile definition to use for all operations * Tile definition to use for all operations
* @type {Array.<Array.<string,number>>} * @type {Array.<Array.<string,number>>}
*/ */
'private _tileDfn': null, _tileDfn: null,
/** /**
* Width of each individual tile * Width of each individual tile
* @type {number} * @type {number}
*/ */
'private _tileWidth': 0, _tileWidth: 0,
/** /**
* Height of each individual tile * Height of each individual tile
* @type {number} * @type {number}
*/ */
'private _tileHeight': 0, _tileHeight: 0,
/** /**
* Number of tiles per row * Number of tiles per row
* @type {number} * @type {number}
*/ */
'private _tilesPerRow': 0, _tilesPerRow: 0,
/** /**
* Calculated width of tile set provided a tile definition * Calculated width of tile set provided a tile definition
* @type {number} * @type {number}
*/ */
'private _setWidth': 0, _setWidth: 0,
/** /**
* Calculated height of tile set provided a tile definition * Calculated height of tile set provided a tile definition
* @type {number} * @type {number}
*/ */
'private _setHeight': 0, _setHeight: 0,
/** /**
@ -133,7 +133,7 @@ module.exports = Class( 'TileMasker',
* @param {TileDfn} tile_dfn tile definition object * @param {TileDfn} tile_dfn tile definition object
* @param {HTMLDocument} document DOM document * @param {HTMLDocument} document DOM document
*/ */
__construct: function( tile_dfn, document ) __construct( tile_dfn, document )
{ {
if ( !( Class.isA( TileDfn, tile_dfn ) ) ) if ( !( Class.isA( TileDfn, tile_dfn ) ) )
{ {
@ -169,7 +169,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _calcSetDimensions': function( tile_dfn ) _calcSetDimensions( tile_dfn )
{ {
// these vars are for clarity // these vars are for clarity
const sizes = tile_dfn.getTileDimensions(), const sizes = tile_dfn.getTileDimensions(),
@ -210,7 +210,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {TileMasker} self * @return {TileMasker} self
*/ */
'public getMaskedTiles': function( bmp_game, bmp_mask, callback ) getMaskedTiles( bmp_game, bmp_mask, callback )
{ {
const _self = this; const _self = this;
@ -235,7 +235,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {Array.<number>} tile width, height and number per row * @return {Array.<number>} tile width, height and number per row
*/ */
'protected getTileDimensions': function() 'protected getTileDimensions'()
{ {
return [ this._tileWidth, this._tileHeight, this._tilesPerRow ]; return [ this._tileWidth, this._tileHeight, this._tilesPerRow ];
}, },
@ -257,7 +257,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {undefined} * @return {undefined}
*/ */
'virtual protected getMaskedTileSet': function( data_mask, callback ) 'virtual protected getMaskedTileSet'( data_mask, callback )
{ {
const tdata = this._tileDfn, const tdata = this._tileDfn,
len = tdata.length, len = tdata.length,
@ -307,7 +307,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {undefined} * @return {undefined}
*/ */
'protected appendTileFrame': function( set, id, mask, data ) 'protected appendTileFrame'( set, id, mask, data )
{ {
const prev = set[ id ]; const prev = set[ id ];
@ -357,7 +357,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {Object} image data for the requested tile * @return {Object} image data for the requested tile
*/ */
'virtual protected getMaskedTileData': function( data_mask, x, y ) 'virtual protected getMaskedTileData'( data_mask, x, y )
{ {
const raw = this.getTileData( x, y ), const raw = this.getTileData( x, y ),
w = raw.width, w = raw.width,
@ -404,7 +404,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {Object} image data for tile * @return {Object} image data for tile
**/ **/
'protected getTileData': function( x, y ) 'protected getTileData'( x, y )
{ {
return this._context.getImageData( return this._context.getImageData(
x, y, this._tileWidth, this._tileHeight x, y, this._tileWidth, this._tileHeight
@ -425,7 +425,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _renderImage': function( bmp, callback ) _renderImage( bmp, callback )
{ {
const _self = this, const _self = this,
img = this._document.createElement( 'img' ); img = this._document.createElement( 'img' );
@ -448,7 +448,7 @@ module.exports = Class( 'TileMasker',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _getImageData': function( bmp, callback ) _getImageData( bmp, callback )
{ {
const _self = this; const _self = this;

View File

@ -25,27 +25,27 @@ module.exports = Class( 'GameObject',
'private _tid': '', 'private _tid': '',
__construct: function( tid ) __construct( tid )
{ {
this._tid = ''+tid; this._tid = ''+tid;
this._pos = 0; this._pos = 0;
}, },
'public getTid': function() getTid()
{ {
return this._tid; return this._tid;
}, },
'public cloneTo': function( dest ) cloneTo( dest )
{ {
return dest; return dest;
}, },
/* jshint -W098 */ /* jshint -W098 */
'virtual public move': function( dir, c, sc ) 'virtual move'( dir, c, sc )
{ {
// move in the appropriate direction (action has been pre-configured // move in the appropriate direction (action has been pre-configured
// with the correct direction) // with the correct direction)

View File

@ -24,7 +24,7 @@ const Class = require( 'easejs' ).Class,
module.exports = Class( 'Tank' ) module.exports = Class( 'Tank' )
.extend( GameObject, .extend( GameObject,
{ {
'override public move': function( direction, c, sc ) 'override move'( direction, c, sc )
{ {
const state = [ 'tleft', 'tup', 'tright', 'tdown' ][ direction ]; const state = [ 'tleft', 'tup', 'tright', 'tdown' ][ direction ];

View File

@ -57,7 +57,7 @@ module.exports = Class( 'ClassicLevel' )
* Size of each level in bytes * Size of each level in bytes
* @type {number} * @type {number}
*/ */
'private const _SIZE': 576, 'const _SIZE': 576,
/** /**
* Game object offset and size * Game object offset and size
@ -67,25 +67,25 @@ module.exports = Class( 'ClassicLevel' )
* *
* @type {Array.<number>} * @type {Array.<number>}
*/ */
'private const _GOSIZE': [ 0, 256 ], 'const _GOSIZE': [ 0, 256 ],
/** /**
* Offset and length of level name * Offset and length of level name
* @type {Array.<number>} * @type {Array.<number>}
*/ */
'private const _NAMESIZE': [ 256, 31 ], 'const _NAMESIZE': [ 256, 31 ],
/** /**
* Offset and length of level hint * Offset and length of level hint
* @type {Array.<number>} * @type {Array.<number>}
*/ */
'private const _HINTSIZE': [ 287, 256 ], 'const _HINTSIZE': [ 287, 256 ],
/** /**
* Offset and length of author name * Offset and length of author name
* @type {Array.<number>} * @type {Array.<number>}
*/ */
'private const _AUTHORSIZE': [ 543, 31 ], 'const _AUTHORSIZE': [ 543, 31 ],
/** /**
* Offset and length of difficulty level * Offset and length of difficulty level
@ -94,13 +94,13 @@ module.exports = Class( 'ClassicLevel' )
* *
* @type {Array.<number>} * @type {Array.<number>}
*/ */
'private const _DIFFSIZE': [ 574, 2 ], 'const _DIFFSIZE': [ 574, 2 ],
/** /**
* Tunnel bitmask * Tunnel bitmask
* @type {number} * @type {number}
*/ */
'private const _TMASK': 0x40, 'const _TMASK': 0x40,
/** /**
* Colors used to identify tunnels * Colors used to identify tunnels
@ -115,7 +115,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @type {Array.<string>} * @type {Array.<string>}
*/ */
'private const _TCOLORS': [ 'const _TCOLORS': [
'#ff0000', '#00ff00', '#0000ff', '#00ffff', // r g b c '#ff0000', '#00ff00', '#0000ff', '#00ffff', // r g b c
'#ffff00', '#ff00ff', '#ffffff', '#808080' // y m w b '#ffff00', '#ff00ff', '#ffffff', '#808080' // y m w b
], ],
@ -125,19 +125,19 @@ module.exports = Class( 'ClassicLevel' )
* Level set data (binary string) * Level set data (binary string)
* @type {string} * @type {string}
*/ */
'private _data': null, _data: null,
/** /**
* Level id (1-indexed) * Level id (1-indexed)
* @type {string} * @type {string}
*/ */
'private _id': 0, _id: 0,
/** /**
* Offset of beginning of level data in bytes * Offset of beginning of level data in bytes
* @type {number} * @type {number}
*/ */
'private _offset': 0, _offset: 0,
/** /**
@ -146,7 +146,7 @@ module.exports = Class( 'ClassicLevel' )
* @param {LevelSet} set level set data * @param {LevelSet} set level set data
* @param {number} id 1-indexed level id * @param {number} id 1-indexed level id
*/ */
__construct: function( data, id ) __construct( data, id )
{ {
this._data = ''+( data ); this._data = ''+( data );
this._id = +id; this._id = +id;
@ -169,7 +169,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {Array.<number>} array of game objects * @return {Array.<number>} array of game objects
*/ */
'public getObjects': function() getObjects()
{ {
const tiles = this._getDataSegment( '_GOSIZE', false ).split( '' ); const tiles = this._getDataSegment( '_GOSIZE', false ).split( '' );
let i = tiles.length; let i = tiles.length;
@ -189,7 +189,7 @@ module.exports = Class( 'ClassicLevel' )
* @param {string} name name of constant containing segment dfn * @param {string} name name of constant containing segment dfn
* @param {=boolean} stripnull whether to strip null bytes (default true) * @param {=boolean} stripnull whether to strip null bytes (default true)
*/ */
'private _getDataSegment': function( name, stripnull ) _getDataSegment( name, stripnull )
{ {
stripnull = ( arguments.length < 2 ) ? true : !!stripnull; stripnull = ( arguments.length < 2 ) ? true : !!stripnull;
@ -207,7 +207,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {Array.<number>} width and height in tiles * @return {Array.<number>} width and height in tiles
*/ */
'public getDimensions': function() getDimensions()
{ {
return [ 16, 16 ]; return [ 16, 16 ];
}, },
@ -218,7 +218,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {Array.<string>} * @return {Array.<string>}
*/ */
'public getObjectTileLevel': function() getObjectTileLevel()
{ {
// we return these values here instead of returning, say, a constant, // we return these values here instead of returning, say, a constant,
// because we would have to clone it to ensure that our inner state // because we would have to clone it to ensure that our inner state
@ -245,7 +245,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {string} tunnel color * @return {string} tunnel color
*/ */
'public getTunnelColor': function( oid ) getTunnelColor( oid )
{ {
// get the tunnel id by stripping off the tunnel bitmask and then // get the tunnel id by stripping off the tunnel bitmask and then
// grab the associated color // grab the associated color
@ -260,7 +260,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {boolean} true if tunnel, otherwise false * @return {boolean} true if tunnel, otherwise false
*/ */
'public isObjectTunnel': function( oid ) isObjectTunnel( oid )
{ {
return ( oid & this.__self.$( '_TMASK' ) ); return ( oid & this.__self.$( '_TMASK' ) );
}, },
@ -271,7 +271,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {string} level name * @return {string} level name
*/ */
'public getLevelName': function() getLevelName()
{ {
return this._getDataSegment( '_NAMESIZE' ); return this._getDataSegment( '_NAMESIZE' );
}, },
@ -282,7 +282,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {string} level author name * @return {string} level author name
*/ */
'public getLevelAuthor': function() getLevelAuthor()
{ {
return this._getDataSegment( '_AUTHORSIZE' ); return this._getDataSegment( '_AUTHORSIZE' );
}, },
@ -293,7 +293,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {string} level hint * @return {string} level hint
*/ */
'public getLevelHint': function() getLevelHint()
{ {
return this._getDataSegment( '_HINTSIZE' ); return this._getDataSegment( '_HINTSIZE' );
}, },
@ -311,7 +311,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {number} 0-indexed difficulty level * @return {number} 0-indexed difficulty level
*/ */
'public getLevelDifficulty': function() getLevelDifficulty()
{ {
const val = this._getDataSegment( '_DIFFSIZE', false ); const val = this._getDataSegment( '_DIFFSIZE', false );
@ -341,7 +341,7 @@ module.exports = Class( 'ClassicLevel' )
* *
* @return {number} size of level in bytes * @return {number} size of level in bytes
*/ */
'public static getLevelSize': function() 'static getLevelSize'()
{ {
return this.$( '_SIZE' ); return this.$( '_SIZE' );
} }

View File

@ -63,7 +63,7 @@ module.exports = Interface( 'Level',
* *
* @return {Array.<number>} array of game objects * @return {Array.<number>} array of game objects
*/ */
'public getObjects': [], getObjects: [],
/** /**
@ -71,7 +71,7 @@ module.exports = Interface( 'Level',
* *
* @return {Array.<number>} width and height in tiles * @return {Array.<number>} width and height in tiles
*/ */
'public getDimensions': [], getDimensions: [],
/** /**
@ -79,7 +79,7 @@ module.exports = Interface( 'Level',
* *
* @return {Array.<string>} * @return {Array.<string>}
*/ */
'public getObjectTileLevel': [], getObjectTileLevel: [],
/** /**
@ -94,7 +94,7 @@ module.exports = Interface( 'Level',
* *
* @return {string} tunnel color or reasonable default if invalid obj id * @return {string} tunnel color or reasonable default if invalid obj id
*/ */
'public getTunnelColor': [ 'object_id' ], getTunnelColor: [ 'object_id' ],
/** /**
@ -102,7 +102,7 @@ module.exports = Interface( 'Level',
* *
* @return {boolean} true if tunnel, otherwise false * @return {boolean} true if tunnel, otherwise false
*/ */
'public isObjectTunnel': [ 'object_id' ], isObjectTunnel: [ 'object_id' ],
/** /**
@ -110,7 +110,7 @@ module.exports = Interface( 'Level',
* *
* @return {string} level name * @return {string} level name
*/ */
'public getLevelName': [], getLevelName: [],
/** /**
@ -118,7 +118,7 @@ module.exports = Interface( 'Level',
* *
* @return {string} level author name * @return {string} level author name
*/ */
'public getLevelAuthor': [], getLevelAuthor: [],
/** /**
@ -126,7 +126,7 @@ module.exports = Interface( 'Level',
* *
* @return {string} level hint * @return {string} level hint
*/ */
'public getLevelHint': [], getLevelHint: [],
/** /**
@ -137,7 +137,7 @@ module.exports = Interface( 'Level',
* *
* @return {number} 0-indexed difficulty level * @return {number} 0-indexed difficulty level
*/ */
'public getLevelDifficulty': [], getLevelDifficulty: [],
/** /**
@ -145,5 +145,5 @@ module.exports = Interface( 'Level',
* *
* @return {number} size of level in bytes * @return {number} size of level in bytes
*/ */
'public static getLevelSize': [] 'static getLevelSize': []
} ); } );

View File

@ -32,16 +32,16 @@ module.exports = Class( 'LevelAction',
'const D__MAX': 3, 'const D__MAX': 3,
'private _dir': 0, _dir: 0,
'private _srcPos': 0, _srcPos: 0,
'public srcPos': 0, srcPos: 0,
'private _bounds': null, _bounds: null,
'private _moveCallback': null, _moveCallback: null,
__construct: function( bounds, move_callback ) __construct( bounds, move_callback )
{ {
if ( !( Class.isA( LevelBounds, bounds ) ) ) if ( !( Class.isA( LevelBounds, bounds ) ) )
{ {
@ -55,7 +55,7 @@ module.exports = Class( 'LevelAction',
}, },
'public move': function() move()
{ {
const method = [ const method = [
'getLeftPos', 'getLeftPos',

View File

@ -33,13 +33,13 @@ module.exports = Class( 'LevelBounds',
* Level width (number of tiles) * Level width (number of tiles)
* @type {number} * @type {number}
*/ */
'private _mw': 0, _mw: 0,
/** /**
* Level height (number of tiles) * Level height (number of tiles)
* @type {number} * @type {number}
*/ */
'private _mh': 0, _mh: 0,
/** /**
@ -47,7 +47,7 @@ module.exports = Class( 'LevelBounds',
* *
* @param {Level} level level for which bounds should be calculated * @param {Level} level level for which bounds should be calculated
*/ */
__construct: function( level ) __construct( level )
{ {
if ( !( Class.isA( Level, level ) ) ) if ( !( Class.isA( Level, level ) ) )
{ {
@ -72,7 +72,7 @@ module.exports = Class( 'LevelBounds',
* *
* @return {number} tile position above given position or current position * @return {number} tile position above given position or current position
*/ */
'public getUpperPos': function( pos ) getUpperPos( pos )
{ {
return ( this.isAtTop( pos ) ) return ( this.isAtTop( pos ) )
? pos ? pos
@ -90,7 +90,7 @@ module.exports = Class( 'LevelBounds',
* *
* @return {number} tile position below given position or current position * @return {number} tile position below given position or current position
*/ */
'public getLowerPos': function( pos ) getLowerPos( pos )
{ {
return ( this.isAtBottom( pos ) ) return ( this.isAtBottom( pos ) )
? pos ? pos
@ -109,7 +109,7 @@ module.exports = Class( 'LevelBounds',
* @return {number} tile position left of given position or current * @return {number} tile position left of given position or current
* position * position
*/ */
'public getLeftPos': function( pos ) getLeftPos( pos )
{ {
return ( this.isAtLeft( pos ) ) return ( this.isAtLeft( pos ) )
? pos ? pos
@ -128,7 +128,7 @@ module.exports = Class( 'LevelBounds',
* @return {number} tile position right of given position or current * @return {number} tile position right of given position or current
* position * position
*/ */
'public getRightPos': function( pos ) getRightPos( pos )
{ {
return ( this.isAtRight( pos ) ) return ( this.isAtRight( pos ) )
? pos ? pos
@ -143,7 +143,7 @@ module.exports = Class( 'LevelBounds',
* *
* @return {boolean} true if within topmost row, otherwise false * @return {boolean} true if within topmost row, otherwise false
*/ */
'public isAtTop': function( pos ) isAtTop( pos )
{ {
// since tile positions are zero-indexed, we know that we're at the // since tile positions are zero-indexed, we know that we're at the
// top if the level height divides the position // top if the level height divides the position
@ -158,7 +158,7 @@ module.exports = Class( 'LevelBounds',
* *
* @return {boolean} true if within bottom row, otherwise false * @return {boolean} true if within bottom row, otherwise false
*/ */
'public isAtBottom': function( pos ) isAtBottom( pos )
{ {
// this "works" because tile positions are vertically indexed // this "works" because tile positions are vertically indexed
return this.isAtTop( pos + 1 ); return this.isAtTop( pos + 1 );
@ -173,7 +173,7 @@ module.exports = Class( 'LevelBounds',
* *
* @return {boolean} true if within leftmost column, otherwise false * @return {boolean} true if within leftmost column, otherwise false
*/ */
'public isAtLeft': function( pos ) isAtLeft( pos )
{ {
// check if index is within the left-most column // check if index is within the left-most column
return ( pos <= this._mh ); return ( pos <= this._mh );
@ -188,7 +188,7 @@ module.exports = Class( 'LevelBounds',
* *
* @return {boolean} true if within rightmost column, otherwise false * @return {boolean} true if within rightmost column, otherwise false
*/ */
'public isAtRight': function( pos ) isAtRight( pos )
{ {
// check if index is within the right-most column // check if index is within the right-most column
return ( pos >= ( this._mh * ( this._mw - 1 ) ) ); return ( pos >= ( this._mh * ( this._mw - 1 ) ) );

View File

@ -30,38 +30,38 @@ module.exports = Class( 'LevelRender',
* Property to hold lock bit on canvas element * Property to hold lock bit on canvas element
* @type {string} * @type {string}
*/ */
'private const _LOCK': '__$$LevelRenderLock$$', 'const _LOCK': '__$$LevelRenderLock$$',
/** /**
* Animation interval in milliseconds * Animation interval in milliseconds
* @type {number} * @type {number}
*/ */
'private const _ANIM_INTERVAL': 200, 'const _ANIM_INTERVAL': 200,
/** /**
* 2d context to which level should be drawn * 2d context to which level should be drawn
* @type {CanvasRenderingContext2d} * @type {CanvasRenderingContext2d}
*/ */
'private _ctx': null, _ctx: null,
/** /**
* 2d context to which masked game objects should be drawn * 2d context to which masked game objects should be drawn
* @type {CanvasRenderingContext2d} * @type {CanvasRenderingContext2d}
*/ */
'private _ctxObj': null, _ctxObj: null,
/** /**
* Tile set to be rendered * Tile set to be rendered
* @type {Object} * @type {Object}
*/ */
'private _tiles': {}, _tiles: {},
/** /**
* Animation timer * Animation timer
* @type {number} * @type {number}
*/ */
'private _animTimer': 0, _animTimer: 0,
/** /**
@ -73,7 +73,7 @@ module.exports = Class( 'LevelRender',
* @param {CanvasRenderingContext2d} ctx canvas 2d context * @param {CanvasRenderingContext2d} ctx canvas 2d context
* @param {Object} tiles tile set to render * @param {Object} tiles tile set to render
*/ */
__construct: function( ctx, tiles ) __construct( ctx, tiles )
{ {
this._ctx = ctx; this._ctx = ctx;
this._tiles = tiles; this._tiles = tiles;
@ -97,7 +97,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _lockCanvas': function() _lockCanvas()
{ {
const o = this._ctx, const o = this._ctx,
l = this.__self.$( '_LOCK' ); l = this.__self.$( '_LOCK' );
@ -127,7 +127,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {LevelRender} self * @return {LevelRender} self
*/ */
'public freeCanvas': function() freeCanvas()
{ {
const c = this._ctxObj.canvas; const c = this._ctxObj.canvas;
@ -148,7 +148,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {CanvasRenderingContext2d} 2d context for new canvas element * @return {CanvasRenderingContext2d} 2d context for new canvas element
*/ */
'private _getObjCanvas': function() _getObjCanvas()
{ {
const canvas = this._ctx.canvas, const canvas = this._ctx.canvas,
document = this._getDocument( canvas ), document = this._getDocument( canvas ),
@ -179,7 +179,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {HTMLDocument} document node * @return {HTMLDocument} document node
*/ */
'private _getDocument': function( element ) _getDocument( element )
{ {
return ( element.parentElement === null ) return ( element.parentElement === null )
? element.parentNode ? element.parentNode
@ -194,7 +194,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {LevelRender} self * @return {LevelRender} self
*/ */
'public render': function( level, level_state ) render( level, level_state )
{ {
if ( !( Class.isA( LevelState, level_state ) ) ) if ( !( Class.isA( LevelState, level_state ) ) )
{ {
@ -272,7 +272,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {Array.<number>} x and y coordinates of tile position * @return {Array.<number>} x and y coordinates of tile position
*/ */
'private _getTileVector': function( pos, sizex, sizey, w, h ) _getTileVector( pos, sizex, sizey, w, h )
{ {
return [ return [
( Math.floor( pos / sizex ) * w ), // x ( Math.floor( pos / sizex ) * w ), // x
@ -298,7 +298,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _clearCanvases': function() _clearCanvases()
{ {
const ctx = this._ctxObj, const ctx = this._ctxObj,
c = ctx.canvas; c = ctx.canvas;
@ -316,7 +316,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {boolean} true if multiple frames, otherwise false * @return {boolean} true if multiple frames, otherwise false
*/ */
'private _canAnimate': function( tid ) _canAnimate( tid )
{ {
const tdata = this._tiles[ tid ]; const tdata = this._tiles[ tid ];
return ( tdata.next !== tdata ); return ( tdata.next !== tdata );
@ -337,7 +337,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _drawTile': function( tile, x, y ) _drawTile( tile, x, y )
{ {
const ctx = ( tile.masked ) ? this._ctxObj : this._ctx; const ctx = ( tile.masked ) ? this._ctxObj : this._ctx;
@ -350,7 +350,7 @@ module.exports = Class( 'LevelRender',
}, },
'private _clearTile': function( ref, x, y ) _clearTile( ref, x, y )
{ {
this._ctxObj.clearRect( x, y, ref.data.width, ref.data.height ); this._ctxObj.clearRect( x, y, ref.data.width, ref.data.height );
}, },
@ -369,7 +369,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _renderTunnel': function( x, y, color ) _renderTunnel( x, y, color )
{ {
const tdata = this._tiles.tunnel.data; const tdata = this._tiles.tunnel.data;
@ -393,7 +393,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {number} animation timer id * @return {number} animation timer id
*/ */
'private _beginAnimation': function( anim ) _beginAnimation( anim )
{ {
const _self = this; const _self = this;
@ -424,7 +424,7 @@ module.exports = Class( 'LevelRender',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _clearAnimation': function() _clearAnimation()
{ {
this._animTimer = +clearInterval( this._animTimer ); this._animTimer = +clearInterval( this._animTimer );
} }

View File

@ -36,19 +36,19 @@ module.exports = Class( 'LevelSet',
* Raw level set data (binary) * Raw level set data (binary)
* @type {string} * @type {string}
*/ */
'private _data': '', _data: '',
/** /**
* Constructor used to create new level instances * Constructor used to create new level instances
* @type {Function} * @type {Function}
*/ */
'private _levelCtor': null, _levelCtor: null,
/** /**
* Number of levels in the given LVL data * Number of levels in the given LVL data
* @type {number} * @type {number}
*/ */
'private _levelCount': 0, _levelCount: 0,
/** /**
@ -59,7 +59,7 @@ module.exports = Class( 'LevelSet',
* @param {string} data binary LVL data * @param {string} data binary LVL data
* @param {Level} level_ctor Level constructor * @param {Level} level_ctor Level constructor
*/ */
__construct: function( data, level_ctor ) __construct( data, level_ctor )
{ {
this._data = ''+( data ); this._data = ''+( data );
this._levelCtor = level_ctor; this._levelCtor = level_ctor;
@ -82,7 +82,7 @@ module.exports = Class( 'LevelSet',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _levelDataCheck': function() _levelDataCheck()
{ {
const n = ( this._data.length / this._levelCtor.getLevelSize() ); const n = ( this._data.length / this._levelCtor.getLevelSize() );
@ -103,7 +103,7 @@ module.exports = Class( 'LevelSet',
* *
* @param {number} id number of level to load, 1-indexed * @param {number} id number of level to load, 1-indexed
*/ */
'public getLevelByNumber': function( id ) getLevelByNumber( id )
{ {
return this._levelCtor( this._data, id ); return this._levelCtor( this._data, id );
}, },
@ -114,7 +114,7 @@ module.exports = Class( 'LevelSet',
* *
* @return {number} number of levels * @return {number} number of levels
*/ */
'public getLevelCount': function() getLevelCount()
{ {
return this._levelCount; return this._levelCount;
}, },

View File

@ -32,31 +32,31 @@ module.exports = Class( 'LevelState',
* Game object factory * Game object factory
* @type {GameObjectFactory} * @type {GameObjectFactory}
*/ */
'private _objFactory': null, _objFactory: null,
/** /**
* Player game object tile position * Player game object tile position
* @type {number} * @type {number}
*/ */
'private _playerPos': 0, _playerPos: 0,
/** /**
* Reference to player object * Reference to player object
* @type {GameObject} * @type {GameObject}
*/ */
'private _player': null, _player: null,
/** /**
* Game objects representing every object on the level * Game objects representing every object on the level
* @type {GameObject} * @type {GameObject}
*/ */
'private _objs': [], _objs: [],
/** /**
* Continuations to invoke when object state changes * Continuations to invoke when object state changes
* @type {Array.<function(GameObject,number)>} * @type {Array.<function(GameObject,number)>}
*/ */
'private _stateCallbacks': [], _stateCallbacks: [],
/** /**
@ -70,7 +70,7 @@ module.exports = Class( 'LevelState',
* @param {Level} level game level * @param {Level} level game level
* @param {GameObjectFactory} obj_factory game object factory * @param {GameObjectFactory} obj_factory game object factory
*/ */
__construct: function( level, obj_factory ) __construct( level, obj_factory )
{ {
if ( !( Class.isA( GameObjectFactory, obj_factory ) ) ) if ( !( Class.isA( GameObjectFactory, obj_factory ) ) )
{ {
@ -92,7 +92,7 @@ module.exports = Class( 'LevelState',
* performant (especially since the level size could be arbitrarily * performant (especially since the level size could be arbitrarily
* large). * large).
*/ */
'public flush': function() flush()
{ {
const _self = this; const _self = this;
@ -122,7 +122,7 @@ module.exports = Class( 'LevelState',
* *
* @return {LevelState} self * @return {LevelState} self
*/ */
'public onChange': function( callback ) onChange( callback )
{ {
this._stateCallbacks.push( callback ); this._stateCallbacks.push( callback );
return this; return this;
@ -143,7 +143,7 @@ module.exports = Class( 'LevelState',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _emitChange': function( obj, pos ) _emitChange( obj, pos )
{ {
const l = this._stateCallbacks.length; const l = this._stateCallbacks.length;
let i = -1; let i = -1;
@ -178,7 +178,7 @@ module.exports = Class( 'LevelState',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _initObjects': function( objs, objlevel ) _initObjects( objs, objlevel )
{ {
let i = objs.length; let i = objs.length;
@ -214,7 +214,7 @@ module.exports = Class( 'LevelState',
* *
* @return {GameObject} new game object * @return {GameObject} new game object
*/ */
'private _createObj': function( tid, from ) _createObj( tid, from )
{ {
const obj = this._objFactory.createObject( tid ); const obj = this._objFactory.createObject( tid );
@ -239,7 +239,7 @@ module.exports = Class( 'LevelState',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _forEachObj': function( c ) _forEachObj( c )
{ {
this._objs.forEach( function( objs, pos ) this._objs.forEach( function( objs, pos )
{ {
@ -265,7 +265,7 @@ module.exports = Class( 'LevelState',
* @throws {Error} if an invalid tile position * @throws {Error} if an invalid tile position
* @throws {TypeError} if an invalid replacement game object * @throws {TypeError} if an invalid replacement game object
*/ */
'private _addObj': function( obj, pos ) _addObj( obj, pos )
{ {
// replace no object with the given object (that is, replace nothing // replace no object with the given object (that is, replace nothing
// with something---add) // with something---add)
@ -303,7 +303,7 @@ module.exports = Class( 'LevelState',
* @throws {Error} if an invalid tile position * @throws {Error} if an invalid tile position
* @throws {TypeError} if an invalid replacement game object * @throws {TypeError} if an invalid replacement game object
*/ */
'private _replaceObj': function( cur, newobj, pos ) _replaceObj( cur, newobj, pos )
{ {
const o = this._objs[ pos ]; const o = this._objs[ pos ];
@ -361,7 +361,7 @@ module.exports = Class( 'LevelState',
* *
* @throws {Error} if an invalid tile position * @throws {Error} if an invalid tile position
*/ */
'private _removeObj': function( obj, pos ) _removeObj( obj, pos )
{ {
this._replaceObj( obj, null, pos ); this._replaceObj( obj, null, pos );
}, },
@ -385,7 +385,7 @@ module.exports = Class( 'LevelState',
* @throws {TypeError} if an invalid game object * @throws {TypeError} if an invalid game object
* @throws {Error} if an invalid tile position * @throws {Error} if an invalid tile position
*/ */
'private _moveObj': function( obj, from, to ) _moveObj( obj, from, to )
{ {
this._removeObj( obj, from ); this._removeObj( obj, from );
this._addObj( obj, to ); this._addObj( obj, to );
@ -402,7 +402,7 @@ module.exports = Class( 'LevelState',
* @param {GameObject} obj game object representing the player * @param {GameObject} obj game object representing the player
* @param {number} pos player tile position * @param {number} pos player tile position
*/ */
'private _initPlayer': function( obj, pos ) _initPlayer( obj, pos )
{ {
this._player = obj; this._player = obj;
this._playerPos = pos; this._playerPos = pos;
@ -428,7 +428,7 @@ module.exports = Class( 'LevelState',
* @throws {TypeError} if state results in an invalid game object * @throws {TypeError} if state results in an invalid game object
* @throws {Error} if an invalid tile position * @throws {Error} if an invalid tile position
*/ */
'private _changeState': function( cur, state, pos ) _changeState( cur, state, pos )
{ {
// if the state has not changed, then do nothing // if the state has not changed, then do nothing
if ( state === cur.getTid() ) if ( state === cur.getTid() )
@ -461,7 +461,7 @@ module.exports = Class( 'LevelState',
* *
* @return {function(string)} callback to perform state change * @return {function(string)} callback to perform state change
*/ */
'private _createStateCallback': function( cur, pos, c ) _createStateCallback( cur, pos, c )
{ {
const _self = this; const _self = this;
@ -494,7 +494,7 @@ module.exports = Class( 'LevelState',
* *
* @return {function(string)} callback to perform state change * @return {function(string)} callback to perform state change
*/ */
'private _createMoveCallback': function( obj, pos, c ) _createMoveCallback( obj, pos, c )
{ {
const _self = this; const _self = this;
@ -524,7 +524,7 @@ module.exports = Class( 'LevelState',
* *
* @return {undefined} * @return {undefined}
*/ */
'public movePlayer': function( direction, bounds ) movePlayer( direction, bounds )
{ {
const _self = this, const _self = this,
player = this._player; player = this._player;

View File

@ -32,7 +32,7 @@ module.exports = Class( 'MenuBar',
* DOM element representing the menu bar * DOM element representing the menu bar
* @type {Element} * @type {Element}
*/ */
'private _bar': null, _bar: null,
/** /**
@ -44,7 +44,7 @@ module.exports = Class( 'MenuBar',
* *
* @param {Element} element DOM element representing menu bar * @param {Element} element DOM element representing menu bar
*/ */
__construct: function( element ) __construct( element )
{ {
// we'll need an id set for this element // we'll need an id set for this element
if ( !element.id ) if ( !element.id )
@ -66,7 +66,7 @@ module.exports = Class( 'MenuBar',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _initMenuActivation': function() _initMenuActivation()
{ {
const id = this._bar.id, const id = this._bar.id,
menus = this._bar.parentNode.querySelectorAll( '#'+id+' > li > a' ), menus = this._bar.parentNode.querySelectorAll( '#'+id+' > li > a' ),
@ -100,7 +100,7 @@ module.exports = Class( 'MenuBar',
* *
* @return {undefined} * @return {undefined}
*/ */
'private _hookMenuMouseOut': function() _hookMenuMouseOut()
{ {
const _self = this, const _self = this,
bar = this._bar; bar = this._bar;
@ -126,7 +126,7 @@ module.exports = Class( 'MenuBar',
* *
* @return {boolean} TRUE if child or node itself, otherwise FALSE * @return {boolean} TRUE if child or node itself, otherwise FALSE
*/ */
'private _isNodeOrChildOf': function( parent, node ) _isNodeOrChildOf( parent, node )
{ {
if ( !node || !node.parentNode ) return false; if ( !node || !node.parentNode ) return false;