This file contains 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
function createEvent(type, bubbles, cancelable) { | |
var ev | |
bubbles = bubbles || true | |
cancelable = cancelable || true | |
if (document.createEvent) { | |
ev = document.createEvent("Event") | |
ev.initEvent(type, bubbles, cancelable) | |
} else if (document.createEventObject) { | |
ev = document.createEventObject() | |
} else { |
This file contains 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
/* partial non-enumerable property implementation | |
Adds a flag to a weakmap saying on obj foo property bar is not enumerable. | |
Then checks that flag in Object.keys emulation. | |
*/ | |
// pd.Name :- https://github.com/Raynos/pd#pd.Name | |
var enumerables = pd.Name(); |
This file contains 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
/** | |
* Javascript Application Core (Layer 1) | |
* ----------------------------------------- | |
* The core is the only part from the application which has direct access to the base library. | |
* Any access to the base library (from a Module) is marshaled down through the Sandbox. | |
* Furthermore, the Core is responsible for Module lifecycles, communication between modules, | |
* error handling and extensions. | |
* | |
* ----------------------------------------- | |
* Author: Andreas Goebel |
This file contains 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 uuid = 0, | |
domShimString = "__domShim__"; | |
var dataManager = { | |
_stores: {}, | |
getStore: function _getStore(el) { | |
var id = el[str]; | |
if (id === undefined) { | |
return this._createStore(el); | |
} |
This file contains 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
fs.readdir(srcPath, handleDirectoryRead.bind(null, srcPath)); | |
function handleDirectoryRead(srcPath, err, files) { | |
files.forEach(handleFile.bind(null, srcPath)); | |
} | |
function handleFile(srcPath, file) { | |
var uri = path.join(srcPath, file); | |
fs.stat(uri, handleStat.bind(null, uri)); | |
} |
This file contains 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 pubsub = (function () { | |
return { pub: pub, sub: sub, evs: {} }; | |
function pub(ev, data) { | |
pubsub.evs[ev] && pubsub.evs[ev].forEach(function (h) { h(data); }); | |
} | |
function sub(ev, h) { | |
(pubsub.evs[ev] || (pubsub.evs[ev] = [])).push(h); | |
} |
This file contains 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 whitelistMap = { | |
"get": ["not_found"], | |
"insert": ["conflict"], | |
"delete": [] | |
} | |
function makeWhitelistCallback(method, thing, cb) { | |
return error.whitelist(function _errors(err) { | |
if (err.syscall === "getaddrinfo") { | |
UserModel[method](thing, cb); |
This file contains 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 adoptNode = (function () { | |
function setOwnerDocument(node, doc) { | |
// implement this. Step 1 of DOM4 adopt a node algorithm | |
node.triggerBaseUrlChange(); | |
node._ownerDocument = doc; | |
node._attributes._ownerDocument = doc; | |
[].forEach.call(node.childNodes, function (node) { | |
setOwnerDocument(node, doc); | |
}); | |
} |
This file contains 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
/* | |
A utility function to turn an object into a property descriptor hash | |
@param Object obj - the Object of keys & values to turn into an object of | |
keys and PropertyDescriptor(value) | |
*/ | |
var pd = function _pd (obj) { | |
var o = {}; | |
Object.keys(obj).forEach(function (key) { | |
var pd = Object.getOwnPropertyDescriptor(obj, key); |
This file contains 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 pd = function _pd(props) { | |
var obj = {}; | |
Object.keys(props).forEach(function (key) { | |
obj[key] = Object.getOwnPropertyDescriptor(props, key); | |
}); | |
return obj; | |
}; | |
pd.merge = function _merge() { | |
var o = {} |