Issues (204)

examples/2.visibility/3.protected.js (1 issue)

Labels
Severity
1
'use strict';
2
require('../../dist/joii.min.js');
3
4
/**
5
 * In this example, we take the class from '2.private.js' but make the private
6
 * property 'some_property' protected. This way, it's still not accessible from
7
 * the outside, but will have getter/setter methods generated for it. (see line
8
 * 14).
9
 */
10
var MyClass = Class({
0 ignored issues
show
Class does not seem to be defined.
Loading history...
11
12
    'protected some_property' : 'Hi there.',
13
14
    'private someMethod' : function () {
15
        return this.getSomeProperty();
16
    },
17
18
    'public anotherMethod': function () {
19
        return this.someMethod();
20
    }
21
22
});
23
24
var a = new MyClass();
25
26
// Prints "undefined".
27
console.log(typeof a.someMethod);
28
console.log(typeof a.getSomeProperty);
29
30
// Prints "Hi there."
31
console.log(a.anotherMethod());
32