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

Accessing Event Listeners #2

Closed
smyth64 opened this issue May 31, 2016 · 2 comments
Closed

Accessing Event Listeners #2

smyth64 opened this issue May 31, 2016 · 2 comments

Comments

@smyth64
Copy link

smyth64 commented May 31, 2016

Hi,
Can you tell me how to access the eventlisteners of the swing library?

I want to do something like this.

// Add event listener for when a card is thrown out of the stack.
stack.on('throwout', (event) => {
    // e.target Reference to the element that has been thrown out of the stack.
    // e.throwDirection Direction in which the element has been thrown (Card.DIRECTION_LEFT, Card.DIRECTION_RIGHT).

    console.log('Card has been thrown out of the stack.');
    console.log('Throw direction: ' + (event.throwDirection == Card.DIRECTION_LEFT ? 'left' : 'right'));
});

// Add event listener for when a card is thrown in the stack, including the spring back into place effect.
stack.on('throwin', () => {
    console.log('Card has snapped back to the stack.');
});
@anbu369
Copy link

anbu369 commented Jun 29, 2016

Hi Did you find out how to access the event listeners?

@ksachdeva
Copy link
Owner

You should be able to get 'stack' from SwingStackComponent. Most likely you will use ViewChild or ViewChildren to get access to the SwingStackComponent and then get 'stack' property. I will update the example to show it shortly

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

No branches or pull requests

3 participants