made with requirebin
Created
August 12, 2014 09:59
-
-
Save bloodyowl/fac45e1e12fd039457b1 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var klass = require("bloody-class") | |
var myClass = klass.extend({ | |
get : function(){ | |
return "deep" | |
} | |
}) | |
.extend({ | |
get : function(){ | |
return "shallow" | |
} | |
}) | |
var myInstance = myClass.create() | |
function append(text){ | |
document.body.appendChild(document.createTextNode(text)) | |
document.body.appendChild(document.createElement("br")) | |
} | |
append(myInstance.accessor("get")()) | |
delete myClass.get | |
append(myInstance.accessor("get")()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"+XqNMH":[function(require,module,exports){var each=require("bloody-collections/lib/each");var mixinDontEnum={constructor:1,destructor:1};var extend=function(object,source,isMixin){each(source,function(item,key){if(isMixin&&mixinDontEnum[key]){return}object[key]=item})};var hasMethod=require("./lib/hasMethod");var create=require("./lib/create");var K=function(){};module.exports={extend:function(object){var subKlass=create(this);extend(subKlass,object);each(subKlass.mixins,function(mixin){extend(this,mixin,true)},subKlass);return subKlass},mixins:[],create:function(){var instance=create(this);var args=arguments;each(this.mixins,function(mixin){if(hasMethod(mixin,"constructor")){mixin.constructor.apply(instance,args)}},this);instance._accessors={};if(hasMethod(instance,"constructor")){instance.constructor.apply(instance,arguments)}return instance},destroy:function(){var args=arguments;if(hasMethod(this,"destructor")){this.destructor.apply(this,arguments)}each(this.mixins,function(mixin){if(hasMethod(mixin,"destructor")){mixin.destructor.apply(this,args)}},this);this._accessors={}},accessor:function(methodName){var thisValue=this;if(this._accessors.hasOwnProperty(methodName)){return this._accessors[methodName]}return this._accessors[methodName]=function(){return thisValue[methodName].apply(thisValue,arguments)}},constructor:K,destructor:K}},{"./lib/create":3,"./lib/hasMethod":4,"bloody-collections/lib/each":7}],"bloody-class":[function(require,module,exports){module.exports=require("+XqNMH")},{}],3:[function(require,module,exports){var toString=Object.prototype.toString;var isNativeRE=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");if(Object.create&&isNativeRE.test(Object.create)){module.exports=Object.create}else{module.exports=function(object){function F(){}F.prototype=object;return new F}}},{}],4:[function(require,module,exports){module.exports=function(object,property){return typeof object[property]=="function"}},{}],5:[function(require,module,exports){module.exports=[function(fn,thisValue){return function(){return fn.call(thisValue)}},function(fn,thisValue){return function(a){return fn.call(thisValue,a)}},function(fn,thisValue){return function(a,b){return fn.call(thisValue,a,b)}},function(fn,thisValue){return function(a,b,c){return fn.call(thisValue,a,b,c)}},function(fn,thisValue){return function(a,b,c,d){return fn.call(thisValue,a,b,c,d)}},function(fn,thisValue){return function(){return fn.apply(thisValue,arguments)}}]},{}],6:[function(require,module,exports){var callbacks=require("./_callbacks");module.exports=function(fn,thisValue,length){if(thisValue===void 0){return fn}if(length in callbacks){return callbacks[length](fn,thisValue)}return callbacks[callbacks.length-1](fn,thisValue)}},{"./_callbacks":5}],7:[function(require,module,exports){var getKeys=require("./getKeys"),createCallback=require("./createCallback"),isArrayLike=require("./isArrayLike");module.exports=function(collection,fn,thisValue){var index=-1,length,keys,key,callback=createCallback(fn,thisValue,3);if(!collection)return;if(isArrayLike(collection)){length=collection.length;while(++index<length){if(callback(collection[index],index,collection)===false)break}return}keys=getKeys(collection);length=keys.length;while(++index<length){key=keys[index];if(callback(collection[key],key,collection)===false)break}}},{"./createCallback":6,"./getKeys":8,"./isArrayLike":9}],8:[function(require,module,exports){var objectPrototype=Object.prototype,enumBugProperties=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable",,"toLocaleString","toString","valueOf"],hasEnumBug=!objectPrototype.propertyIsEnumerable.call({constructor:1},"constructor"),_hasOwnProperty=objectPrototype.hasOwnProperty,hasObjectKeys=typeof Object.keys=="function",objectKeys=Object.keys;module.exports=function(object){var index,keys,length,enumKey;if(object==null)return[];if(hasObjectKeys)return objectKeys(object);keys=[];for(index in object){if(_hasOwnProperty.call(object,index))keys.push(index)}if(hasEnumBug){index=-1;length=enumBugProperties.length;while(++index<length){enumKey=enumBugProperties[index];if(_hasOwnProperty.call(object,enumKey)){keys.push(enumKey)}}}return keys}},{}],9:[function(require,module,exports){var _hasOwnProperty={}.hasOwnProperty;module.exports=function(object){var length;return object&&parseInt(length=object.length,10)===length&&!length||_hasOwnProperty.call(object,length-1)}},{}]},{},[]);var klass=require("bloody-class");var myClass=klass.extend({get:function(){return"deep"}}).extend({get:function(){return"shallow"}});var myInstance=myClass.create();function append(text){document.body.appendChild(document.createTextNode(text));document.body.appendChild(document.createElement("br"))}append(myInstance.accessor("get")());delete myClass.get;append(myInstance.accessor("get")()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"bloody-class": "1.4.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment