future.js
function() {
		if (!this.resolved) {
			throw new Error('Future must resolve before value is ready');
		} else if (this.error) {
			// Link the stack traces up
			var error = this.error;
			var localStack = {};
			Error.captureStackTrace(localStack, Future.prototype.get);
			var futureStack = Object.getOwnPropertyDescriptor(error, 'futureStack');
			if (!futureStack) {
				futureStack = Object.getOwnPropertyDescriptor(error, 'stack');
				if (futureStack) {
					Object.defineProperty(error, 'futureStack', futureStack);
				}
			}
			if (futureStack && futureStack.get) {
				Object.defineProperty(error, 'stack', {
					get: function() {
						var stack = futureStack.get.apply(error);
						if (stack) {
							stack = stack.split('\n');
							return [stack[0]]
								.concat(localStack.stack.split('\n').slice(1))
								.concat('    - - - - -')
								.concat(stack.slice(1))
								.join('\n');
						} else {
							return localStack.stack;
						}
					},
					set: function(stack) {
						Object.defineProperty(error, 'stack', {
							value: stack,
							configurable: true,
							enumerable: false,
							writable: true,
						});
					},
					configurable: true,
					enumerable: false,
				});
			}
			throw error;
		} else {
			return this.value;
		}
	}
function() {
		if (!this.resolved) {
			throw new Error('Future must resolve before value is ready');
		} else if (this.error) {
			// Link the stack traces up
			var error = this.error;
			var localStack = {};
			Error.captureStackTrace(localStack, Future.prototype.get);
			var futureStack = Object.getOwnPropertyDescriptor(error, 'futureStack');
			if (!futureStack) {
				futureStack = Object.getOwnPropertyDescriptor(error, 'stack');
				if (futureStack) {
					Object.defineProperty(error, 'futureStack', futureStack);
				}
			}
			if (futureStack && futureStack.get) {
				Object.defineProperty(error, 'stack', {
					get: function() {
						var stack = futureStack.get.apply(error);
						if (stack) {
							stack = stack.split('\n');
							return [stack[0]]
								.concat(localStack.stack.split('\n').slice(1))
								.concat('    - - - - -')
								.concat(stack.slice(1))
								.join('\n');
						} else {
							return localStack.stack;
						}
					},
					set: function(stack) {
						Object.defineProperty(error, 'stack', {
							value: stack,
							configurable: true,
							enumerable: false,
							writable: true,
						});
					},
					configurable: true,
					enumerable: false,
				});
			}
			throw error;
		} else {
			return this.value;
		}
	}
function ( ) { if ( ! this . resolved ) { throw new Error ( 'Future must resolve before value is ready' ) ; } else if ( this . error ) { // Link the stack traces up var error = this . error ; var localStack = { } ; Error . captureStackTrace ( localStack , Future . prototype . get ) ; var futureStack = Object . getOwnPropertyDescriptor ( error , 'futureStack' ) ; if ( ! futureStack ) { futureStack = Object . getOwnPropertyDescriptor ( error , 'stack' ) ; if ( futureStack ) { Object . defineProperty ( error , 'futureStack' , futureStack ) ; } } if ( futureStack && futureStack . get ) { Object . defineProperty ( error , 'stack' , { get : function ( ) { var stack = futureStack . get . apply ( error ) ; if ( stack ) { stack = stack . split ( '\n' ) ; return [ stack [ 0 ] ] . concat ( localStack . stack . split ( '\n' ) . slice ( 1 ) ) . concat ( '    - - - - -' ) . concat ( stack . slice ( 1 ) ) . join ( '\n' ) ; } else { return localStack . stack ; } } , set : function ( stack ) { Object . defineProperty ( error , 'stack' , { value : stack , configurable : true , enumerable : false , writable : true , } ) ; } , configurable : true , enumerable : false , } ) ; } throw error ; } else { return this . value ; } }
Return the value of this future. If the future hasn't resolved yet this will throw an error.
Return the value of this future . If the future hasn t resolved yet this will throw an error .