JavaScript JavaScript Singleton and IntelliJ Idea

I'm having trouble with IntelliJ Idea's code completion and syntax checking and JavaScript.

I have the following (simplified) code for a Singleton object:

var MySingleton = new function() {
    var self = this;

    self.prop = "hello world";

    self.printHello = function() {
        console.log(self.prop);
    };
};

MySingleton.printHello();

The problem is, that IntelliJ complains at the last line about Unresolved function or method printHello(). It also will not suggest printHello when autocompleting from MySingleton.. The code itself works fine though.

I guess I have to either annotate or rewrite my code in a different style. But how?

Answer:1

I have a nested array. It is about user information. I need to take the age from the user and add it to my array. I have tried some code approch. Did not work. Here is the Array var userData = [ { ...

I have a nested array. It is about user information. I need to take the age from the user and add it to my array. I have tried some code approch. Did not work. Here is the Array var userData = [ { ...

  1. add element to nested list python
  2. add element to nested dictionary python
  3. add element to nested array mongodb
  4. add element to nested table oracle
  5. add element in nested list
  6. add element to nested dictionary
  7. add element to nested table
  8. add element to nested array

I try to update the HandsonTable settings on the fly. The settings seem to update but the rendered table still uses the previous settings. Example: http://jsfiddle.net/kAFWA/30/ updateSettings ...

I try to update the HandsonTable settings on the fly. The settings seem to update but the rendered table still uses the previous settings. Example: http://jsfiddle.net/kAFWA/30/ updateSettings ...

I am looking at updating some older js libs I have to typescript using the ES6 conventions, however I have come across a stumbling point. So historically when I loaded a JSON file dynamically I would ...

I am looking at updating some older js libs I have to typescript using the ES6 conventions, however I have come across a stumbling point. So historically when I loaded a JSON file dynamically I would ...

Current my page has a menu bar and iframe section to load the items in the menu bar when clicked. I wanted the iframe to scroll but not the parent page (i want the menu bar fixed to the top). But the ...

Current my page has a menu bar and iframe section to load the items in the menu bar when clicked. I wanted the iframe to scroll but not the parent page (i want the menu bar fixed to the top). But the ...