-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.html
70 lines (57 loc) · 1.78 KB
/
sample.html
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
<html>
<head>
<script type="text/javascript" src="pia.js"></script>
<script type="text/javascript">
function load(){
var Library = $class({
// constructor
initialize : function(name){
this.name = name; // private instance property
},
// public instance methods
public : {
getName : function(){
return this.prefix() + this.makeName();
},
setName : function(name){
return this.name = name;
},
prefix : function(){
return "Javascript Library: ";
}
},
// private instance methods
private : {
makeName : function(){
return this.name.toUpperCase();
}
},
// class method
self : {
// public class method
public : {
libraryName : function(){
return "pia" + this.extension();
}
},
// private class method
private : {
extension : function(){
return ".js";
}
},
}
});
console.log( Library.libraryName() ); // pia.js
var library = Library.new("pia.js");
console.log( library.name ); // undefined
console.log( library.getName() ); // Javascript Library: PIA.JS
library.setName("jquery");
console.log( library.getName() ); // Javascript Library: JQUERY
console.log( library.makeName() ); // library has no method 'makeName'
}
</script>
</head>
<body onload="load()">
</body>
</html>