process.js 629 B

1234567891011121314151617181920212223
  1. ({define:typeof define!="undefined"?define:function(factory){factory(require,exports)}}).
  2. define(function(req,exports){
  3. if(typeof console !== "undefined"){
  4. exports.print = function(){
  5. console.log.apply(console, arguments);
  6. }
  7. }
  8. if(typeof process !== "undefined"){
  9. exports.args = process.argv;
  10. exports.env = process.env;
  11. exports.print = console.log;
  12. exports.dir = console.dir;
  13. }
  14. else if(typeof navigator === "undefined"){
  15. try{
  16. exports.args = req("" + "system").args;
  17. exports.env = req("" + "system").env;
  18. }catch(e){
  19. // in raw rhino, we don't even have system
  20. }
  21. exports.print = print;
  22. }
  23. });