Skip to content

Instantly share code, notes, and snippets.

@adrienpoly
Last active October 20, 2020 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrienpoly/de2b3cbb1b24ba9fb07bb60a60892719 to your computer and use it in GitHub Desktop.
Save adrienpoly/de2b3cbb1b24ba9fb07bb60a60892719 to your computer and use it in GitHub Desktop.
accessing static values from a class instance
class A extends Controller {
static targets = ["a", "b"]
connect() {
A.targets // -> ["a", "b"]
}
}
export default class extends Controller {
static targets = ["a", "b"]
connect() {
this.constructor.targets // -> ["a", "b"]
}
}
@julianrubisch
Copy link

🥳

@adrienpoly
Copy link
Author

yeah thanks @julianrubisch for pointing me to the right direction with that

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