Skip to content
This repository was archived by the owner on Mar 1, 2021. It is now read-only.

Commit cac9359

Browse files
committed
Add Singleton Example
1 parent 91e99f4 commit cac9359

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Diff for: singleton/namespace/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Singleton: Namespace</title>
6+
<meta name="description" content="">
7+
<meta name="author" content="">
8+
</head>
9+
<body>
10+
<script type="text/javascript" src="main.js"></script>
11+
</body>
12+
</html>

Diff for: singleton/namespace/main.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var NAMESPACE = {};
2+
3+
NAMESPACE.Widget = function(foo, bar) {
4+
// Some awesome widget code
5+
};
6+
7+
NAMESPACE.Widget.prototype.doSomethingAwesome = function() {
8+
// do something awesome!!!
9+
};
10+
11+
var myWidget = new NAMESPACE.Widget('hello', 'world');

0 commit comments

Comments
 (0)