Where should this code live and how should I reference it? I've pared it down to just the function in each of globals.js and Ti/API.js, but I'm not sure how to organize the original definition so it's re-used - unless I just include the console overrides in Ti/API.js along with the Ti.API.* overrides...


From: Bryan Hughes <notifications@github.com<mailto:notifications@github.com>>
Reply-To: appcelerator/titanium-code-processor <reply@reply.github.com<mailto:reply@reply.github.com>>
Date: Wednesday, July 24, 2013 2:58 PM
To: appcelerator/titanium-code-processor <titanium-code-processor@noreply.github.com<mailto:titanium-code-processor@noreply.github.com>>
Cc: Christopher Williams <cwilliams@appcelerator.com<mailto:cwilliams@appcelerator.com>>
Subject: Re: [titanium-code-processor] TIMOB-13183 CodeProcessor: Merge require and common-globals plugins into ti-api-provider (#227)


In plugins/ti-api-provider/lib/overrides/Ti/API.js:

> \ No newline at end of file
> +};
> +
> +/**
> + * console.*() prototype method
> + *
> + * @private
> + */
> +function ConsoleFunc(type, className) {
> +     Base.ObjectType.call(this, className || 'Function');
> +     this.put('length', new Base.NumberType(1), false, true);
> +     this._type = type;
> +}
> +util.inherits(ConsoleFunc, Base.FunctionTypeBase);
> +ConsoleFunc.prototype.callFunction = Base.wrapNativeCall(function callFunction(thisVal, args) {


The console object should not be duplicated across files, but should be shared instead.

-
Reply to this email directly or view it on GitHub<https://github.com/appcelerator/titanium-code-processor/pull/227/files#r5380565>.