Skip to content

Commit

Permalink
Merge pull request #44 from discordier/hotfix/return-types
Browse files Browse the repository at this point in the history
Return `this` in `.start()` and `.update()`
  • Loading branch information
Mugen87 committed May 3, 2021
2 parents 6314fd6 + 2a5dcc6 commit 90d7439
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/core/GameEntity.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ class GameEntity {
*
* @return {GameEntity} A reference to this game entity.
*/
start() {}
start() {

return this;

}

/**
* Updates the internal state of this game entity. Normally called by {@link EntityManager#update}
Expand All @@ -213,7 +217,11 @@ class GameEntity {
* @param {Number} delta - The time delta.
* @return {GameEntity} A reference to this game entity.
*/
update( /* delta */ ) {}
update( /* delta */ ) {

return this;

}


/**
Expand Down
14 changes: 14 additions & 0 deletions test/unit_test/core/GameEntity.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ describe( 'GameEntity', function () {

} );

it( 'should return self', function () {

const entity = new GameEntity();
expect( entity.start() ).to.equal( entity );

} );

} );

describe( '#update()', function () {
Expand All @@ -76,6 +83,13 @@ describe( 'GameEntity', function () {

} );

it( 'should return self', function () {

const entity = new GameEntity();
expect( entity.update() ).to.equal( entity );

} );

} );

describe( '#add()', function () {
Expand Down

0 comments on commit 90d7439

Please sign in to comment.