Skip to content

Instantly share code, notes, and snippets.

View flyingzl's full-sized avatar
🎯
Focusing

石头 flyingzl

🎯
Focusing
  • Chengdu,China
View GitHub Profile
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key))
child[key] = parent[key];
}
function ctor() {
this.constructor = child;
}
@flyingzl
flyingzl / singleton.js
Created January 23, 2013 13:06
javascript singleton pattern
var Singleton =(function(){
var _instance ;
function init(){
return {
method: function(){
return 1;
},
property: 'hello'
}
}