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

Application level event emitter? #14

Open
jfrux opened this issue Sep 27, 2012 · 7 comments
Open

Application level event emitter? #14

jfrux opened this issue Sep 27, 2012 · 7 comments

Comments

@jfrux
Copy link
Contributor

jfrux commented Sep 27, 2012

Brain storming on how we could manage app level events.
Thinking the emitter's domain code

@russplaysguitar
Copy link
Member

What are the requirements for those events?

@jfrux
Copy link
Contributor Author

jfrux commented Sep 27, 2012

I dunno... Maybe like triggering events across an entire application.
Application.on('customEvent',function() {});

@russplaysguitar
Copy link
Member

Well, keep in mind that "Application" is a reserved word (for the application scope). A common way to solve this problem would be to instantiate an event handler and put it into the application scope:

application.eventHandler.on('customEvent',function() {});

Then in subsequent pages, you could do:

application.eventHandler.trigger('customEvent');

Also, don't forget to wrap that stuff with the appropriate scope-locks (cflock tag).

@jfrux
Copy link
Contributor Author

jfrux commented Sep 27, 2012

No, I'm specifically referring to tying into the app scope.

But it would be locked within emitter.

var e = new foundry.emitter();
e.on('application.onCustomEvent',function() {});

Sent from my iPhone

On Sep 27, 2012, at 7:19 PM, Russ [email protected] wrote:

Well, keep in mind that "Application" is a reserved word (for the
application scope). A common way to solve this problem would be to
instantiate an event handler and put it into the application scope:

application.eventHandler.on('customEvent',function() {});

Then in subsequent pages, you could do:

application.eventHandler.trigger('customEvent');

Also, don't forget to wrap that stuff with the appropriate scope-locks
(cflock tag).


Reply to this email directly or view it on
GitHubhttps://github.com//issues/14#issuecomment-8958375.

@russplaysguitar
Copy link
Member

I don't understand. Could you explain more?

@jfrux
Copy link
Contributor Author

jfrux commented Sep 27, 2012

I'm sorry, we're saying the same thing!
You understand fine.:D

Sent from my iPhone

On Sep 27, 2012, at 7:36 PM, Russ [email protected] wrote:

I don't understand. Could you explain more?


Reply to this email directly or view it on
GitHubhttps://github.com//issues/14#issuecomment-8958738.

@jfrux
Copy link
Contributor Author

jfrux commented Sep 28, 2012

But ya, like you said it would manage locks and race conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants