forked from joshmarinacci/aminogfx-gl
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjs.js
More file actions
76 lines (58 loc) · 1.09 KB
/
js.js
File metadata and controls
76 lines (58 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
'use strict';
/*
* Inheritance Test.
*
* - extend a native class
* - overload constructor and method
*/
//
// String
//
/**
* Extend String.
*/
class MyString extends String {
constructor(text) {
super(text);
console.log('MyString: constructor');
this.indexOf('a');
}
indexOf(ch) {
console.log('MyString.indexOf() ' + ch);
return super.indexOf(ch);
}
}
const str1 = new MyString('test');
str1.indexOf('.');
//
// AminoGfx.Polygon
//
const amino = require('../../main.js');
const AminoGfx = amino.AminoGfx;
const Polygon = AminoGfx.Polygon;
/**
* Extend AminoGfx Class.
*/
class Circle extends Polygon {
constructor(amino) {
super(amino);
console.log('Circle: constructor');
/*
* Issues:
*
* - Node v6.9.1
* - TypeError: this.setup is not a function
*
* Works fine:
*
* - Node v4.x
* - Node v7.0.0
*/
this.setup();
}
setup() {
console.log('Circle.setup()');
}
}
const gfx = new AminoGfx();
new Circle(gfx);