question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Link to a constructor function's prototype

See original GitHub issue

With the following code:

function Person(name) {
  this.name = name;
}
Person.prototype.sayName = function() {
  console.log(this.name);
}

var john = new Person('john');
john.sayName();

It would be nice if js-hyperclick could link the sayName on the last line back to its definition.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AsaAyerscommented, Apr 6, 2016

http://ternjs.net/ seems to be trying to solve this problem. It’s complex enough to need to spin up a whole server for analysis that has a client in your editor.

If you’ll switch to writing Flow instead of standard JavaScript Nuclide has jump to definition support

0reactions
brunolemoscommented, Apr 7, 2016

Thanks, I’m using atom-ternjs@0.12.2 now, which has this feature working (v0.13 had a bug about it).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object.prototype.constructor - JavaScript - MDN Web Docs
The constructor data property of an Object instance returns a reference to the constructor function that created the instance object.
Read more >
An Visual Guide to JavaScript Constructor / Prototype Pattern
Use JavaScript constructor/prototype to define a custom type in ES5. · Initialize the object properties in the constructor function and define methods and ......
Read more >
5.4: Constructor Functions and Prototype Objects
A simple solution is to have Constructor Functions have a special property map associated with the function, and then have a link to...
Read more >
Link Constructors prototypes to create Inheritance in JavaScript
A function returns a newly created object if it is called using the new, which is also known as Constructor Invocation Pattern. You...
Read more >
How to link two constructors and inherit them as prototype to ...
Not yet :-) Your prototype objects are empty. ... create the sub-class constructor function Sample2(name, age) { // invokes superclass ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found