Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: event handlers arguments #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/scenemanager.js
Expand Up @@ -45,7 +45,7 @@ function SceneManager(p)
for(var i = 0; i < P5Events.length; i++)
{
let sEvent = P5Events[i]; // let is necesary to set the scope at the level of for
o[sEvent] = function() { me.handleEvent(sEvent) };
o[sEvent] = function() { me.handleEvent(sEvent, [].slice.call(arguments)) };
}

return me;
Expand Down Expand Up @@ -179,14 +179,14 @@ function SceneManager(p)

// Handle a certain even for a scene...
// It is used by the anonymous functions from the wire() function
this.handleEvent = function(sEvent)
this.handleEvent = function(sEvent, args)
{
if ( this.scene == null || this.scene.oScene == null )
return;

var fnSceneEvent = this.scene.oScene[sEvent];
if (fnSceneEvent)
fnSceneEvent.call(this.scene.oScene);
fnSceneEvent.apply(this.scene.oScene, args);
}

// Legacy method... preserved for maintaining compatibility
Expand Down