publish.js 626 B

123456789101112131415161718192021
  1. function publish(symbolSet)
  2. {
  3. var allSymbols = symbolSet.toArray();
  4. for (var i = 0; i < allSymbols.length; ++i)
  5. {
  6. var sym = allSymbols[i];
  7. if (sym.isa === "CONSTRUCTOR")
  8. {
  9. var all = [];
  10. var parts = sym.alias.split(".");
  11. for (var j = 0; j < parts.length; ++j)
  12. {
  13. if (j === 0)
  14. all.push("window." + parts[0]);
  15. else
  16. all.push(parts.slice(0, j + 1).join("."));
  17. }
  18. print("if (" + all.join(" && ") + ") " + sym.alias + ".$isctor=true;");
  19. }
  20. }
  21. }