0

I wrote some javascript code relying on Prototype.js.

Prototype.js's way to define classes is the following:

var Person = Class.create({
  initialize: function(name) {
    this.name = name;
  },
  say: function(message) {
    return this.name + ': ' + message;
  }
});

All the keys passed to Class.create will be added to Person.prototype. With this mechanism Prototype.js is able to offer inheritance. [link]


Closure compiler now complains because it thinks that those initialize and say functions are "neither a prototype method nor marked as a constructor". [link, check: JCS_UNSAFE_THIS]

Is there any way to fix this?

peoro
  • 25,562
  • 20
  • 98
  • 150

1 Answers1

1

While not an exact duplicate question, the answer would be.

Reference John's answer to reformat javascript to accommodate google-closure-compiler's namespace flattening

Community
  • 1
  • 1
Chad Killingsworth
  • 14,360
  • 2
  • 34
  • 57