src/topiarist.js
function getSandboxedFunction(myMixId, Mix, func) {
	var result = function() {
		var mixInstances = nonenum(this, '__multiparentInstances__', []);
		var mixInstance = mixInstances[myMixId];
		if (mixInstance == null) {
			if (typeof Mix === 'function') {
				mixInstance = new Mix();
			} else {
				mixInstance = Object.create(Mix);
			}
			// could add a nonenum pointer to __this__ or something if we wanted to allow escape from the sandbox.
			mixInstances[myMixId] = mixInstance;
		}
		return func.apply(mixInstance, arguments);
	};

	nonenum(result, '__original__', func);
	nonenum(result, '__source__', Mix);

	return result;
}
function getSandboxedFunction(myMixId, Mix, func) {
	var result = function() {
		var mixInstances = nonenum(this, '__multiparentInstances__', []);
		var mixInstance = mixInstances[myMixId];
		if (mixInstance == null) {
			if (typeof Mix === 'function') {
				mixInstance = new Mix();
			} else {
				mixInstance = Object.create(Mix);
			}
			// could add a nonenum pointer to __this__ or something if we wanted to allow escape from the sandbox.
			mixInstances[myMixId] = mixInstance;
		}
		return func.apply(mixInstance, arguments);
	};

	nonenum(result, '__original__', func);
	nonenum(result, '__source__', Mix);

	return result;
}
function getSandboxedFunction ( myMixId , Mix , func ) { var result = function ( ) { var mixInstances = nonenum ( this , '__multiparentInstances__' , [ ] ) ; var mixInstance = mixInstances [ myMixId ] ; if ( mixInstance == null ) { if ( typeof Mix === 'function' ) { mixInstance = new Mix ( ) ; } else { mixInstance = Object . create ( Mix ) ; } // could add a nonenum pointer to __this__ or something if we wanted to allow escape from the sandbox. mixInstances [ myMixId ] = mixInstance ; } return func . apply ( mixInstance , arguments ) ; } ; nonenum ( result , '__original__' , func ) ; nonenum ( result , '__source__' , Mix ) ; return result ; }
Mixin functions are sandboxed into their own instance.
@private
Mixin functions are sandboxed into their own instance .