Skip to content

Instantly share code, notes, and snippets.

View bryanforbes's full-sized avatar

Bryan Forbes bryanforbes

View GitHub Profile
function MyPromise(executor) {
Promise.call(this, executor);
}
MyPromise.prototype = Object.create(Promise.prototype);
MyPromise.prototype.constructor = MyPromise;
var p = new MyPromise(function () {});
export function hidden(target: Object, key: string): void {
// Define a non-enumerable property on the prototype
Object.defineProperty(target, key, {
enumerable: false,
set: function (value) {
// The first time the property is set on an instance, define a non-enumerable property on the instance
Object.defineProperty(this, key, {
enumerable: false,
writable: true,
import { hasClass } from './decorators';
import global from './global';
module Native {
interface NativeWeakMap<K, V> {
delete(key: K): boolean;
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): NativeWeakMap<K, V>;
}

Keybase proof

I hereby claim:

  • I am bryanforbes on github.
  • I am bryanforbes (https://keybase.io/bryanforbes) on keybase.
  • I have a public key whose fingerprint is 3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D

To claim this, I am signing this object:

import intern = require('intern');
import echo = require('intern/dojo/has!host-node?./services/echo');
let server: any;
if (echo && intern.mode === 'runner') {
echo.start().then(function (_server: any) {
server = _server;
});
}
define(function (require) {
var B = require('./B');
return function () {
B();
};
});
// ambient module definition
declare module 'dojo-core/Promise' {
// interface definition
export interface Executor<T> {
(resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void): void;
}
// function definition
export function isThenable(value: any): boolean;
addtest('bug-root-children-arent-styled', function(g, d, e){
var result = null, root;
if(d && d.documentElement && e){
root = d.documentElement;
e.style.cssText = 'width:40px;height:40px;';
try{
root.insertBefore(e, root.firstChild);
result = e.clientWidth == 0;
(function(global){
var NON_HOST_TYPES = { "boolean": 1, "number": 1, "string": 1, "undefined": 1 },
_listen, _stopListening, normalizeEventName;
// Imported from http://github.com/phiggins42/has.js.
// Host objects can return type values that are different from their actual
// data type. The objects we are concerned with usually return non-primitive
// types of object, function, or unknown.
function isHostType(object, property){
var type = typeof object[property];
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="2;url=">
<title>Leak Fix with Lookup Wrapper</title>
<script src="helper.js"></script>
<script>
var _cache = {};
var createWrapper = (function(){