Skip to content

Instantly share code, notes, and snippets.

@taterbase
Created March 5, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taterbase/d1e776cca89487793130 to your computer and use it in GitHub Desktop.
Save taterbase/d1e776cca89487793130 to your computer and use it in GitHub Desktop.
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Rebuild to run it on the right
var assign = require('object-assign')
var inherits = require('inherits')
var A = function() {
}
//class method
A.hi = function() {
//class/static property
var msg = this.msg
document.body.innerHTML = msg
}
var B = function() {
A.call(this)
}
//class/static property
B.msg = "Hi there"
inherits(B, A)
assign(B, A)
B.hi()
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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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}({inherits:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}]},{},[]);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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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}({"object-assign":[function(require,module,exports){"use strict";function ToObject(val){if(val==null){throw new TypeError("Object.assign cannot be called with null or undefined")}return Object(val)}module.exports=Object.assign||function(target,source){var from;var keys;var to=ToObject(target);for(var s=1;s<arguments.length;s++){from=arguments[s];keys=Object.keys(Object(from));for(var i=0;i<keys.length;i++){to[keys[i]]=from[keys[i]]}}return to}},{}]},{},[]);var assign=require("object-assign");var inherits=require("inherits");var A=function(){};A.hi=function(){var msg=this.msg;document.body.innerHTML=msg};var B=function(){A.call(this)};B.msg="Hi there";inherits(B,A);assign(B,A);B.hi();
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"inherits": "2.0.1",
"object-assign": "2.0.0"
}
}
<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