this way is much better, because it's impossible for two modules exports to collide with each other.
On Wed, Aug 1, 2012 at 6:49 PM, Seiji Sam Lee <[email protected]> wrote: > Thanks Tim, I believe I will choose a syntaxis like this: > > var common=$script.imports("common.jsi",true); > > > It have much more advantages ;-) > > El 01/08/12 18:30, Tim Caswell escribió: > >> JavaScript doesn't give you access to the current scope (where local >> vars are stored). The only way to programatecilly create entries in >> it is to use eval. >> >> My suggestion is think of another API that's more JS friendly. There >> is a reason node dropped import syntax and now only supports require >> where you have to store the return value somewhere. >> >> On Wed, Aug 1, 2012 at 7:31 AM, Seiji Sam Lee <[email protected]> >> wrote: >>> >>> For Tim & Dominic: >>> >>> Well the complete code is ... >>> >>> <?node.js >>> >>> var common=$script.imports("common.jsi",true); >>> >>> var width =750; >>> var height=300; >>> >>> .... >>> >>> ?> >>> >>> >>> As you can see this is a piece of javascript embedded into other language >>> (asp, php like). >>> I built a whirler to convert this to JS and ... execute it into a VM >>> (runIn{This,New}Context) >>> >>> You can see too $script.imports(...) loads a JS include (*.jsi) and >>> execute >>> it into OTHER VM, and that was my question... >>> >>> I have this syntax: >>> >>> var common=$script.imports("common.jsi",true); >>> >>> because I dont know how achieve common.jsi create variables into the >>> context >>> that call it, so now the only way to perform that is returns an object >>> (var >>> common). >>> >>> I would like this syntax: >>> >>> $script.imports("common.jsi",true); >>> >>> and that this call (remember VM) creates variables in this (no literal) >>> context. >>>> >>>> >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en > > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
