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

Refactor Keybindings and Set Defaults #501

Open
danpastori opened this issue May 4, 2022 Discussed in #500 · 0 comments · May be fixed by #514
Open

Refactor Keybindings and Set Defaults #501

danpastori opened this issue May 4, 2022 Discussed in #500 · 0 comments · May be fixed by #514
Assignees
Labels

Comments

@danpastori
Copy link
Contributor

Discussed in #500

Originally posted by danpastori May 4, 2022

👉 Describe the problem

Allow for default keybindings to be set to control the audio player from the keyboard. It's a pain to set this everytime when 90% of the time the same button is going to perform the same task.

👥 Problem evidence & reach

Anyone wanting to control the audio player from the keyboard

🥰 Describe the "impact" on users?

You won't have to figure out basic key binding support, but maintain the ability to set any function to any key.

🏆 How to solve this problem

Step 1: Refactor the bindings config key to be key_bindings

This will be a breaking change, but makes more sense. Documentation will be provided.

Step 2: Allow for the following configurations for keybindings:

Binding from key id to Amplitude method

{
	key_bindings: [
		{
			key: 39,
			method: 'play'
		}
	]
}

Binding from key id to callback method

{
	key_bindings: [
		{
			key: 39,
			method: function(){
				// run method
			}
		}
	]
}

Binding from key id to custom method defined elsewhere

{
	key_bindings: [
		{
			key: 39,
			method: 'my_custom_method'
		}
	]
}

Default keybindings

{
	key_bindings: {
		default: true
	}
}

💯 How do we validate the problem is solved?

Developers will be able to provide complete custom control from their keyboard to their audio player defined through the key_bindings config key. They will be able to map to an Amplitude method, callback method, custom method, or set just the defaults which will be defined in the documentation.

@danpastori danpastori added the Enhancement ⚡️ New feature label May 4, 2022
@danpastori danpastori self-assigned this May 4, 2022
@danpastori danpastori moved this to Ready for Development in AmplitudeJS 6.0 May 4, 2022
@danpastori danpastori linked a pull request Jun 3, 2022 that will close this issue
75 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready for Development
Development

Successfully merging a pull request may close this issue.

1 participant