Front end of the Slack clone application.

index.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
  4. ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
  5. XMLDocument = require('./XMLDocument');
  6. XMLDocumentCB = require('./XMLDocumentCB');
  7. XMLStringWriter = require('./XMLStringWriter');
  8. XMLStreamWriter = require('./XMLStreamWriter');
  9. module.exports.create = function(name, xmldec, doctype, options) {
  10. var doc, root;
  11. if (name == null) {
  12. throw new Error("Root element needs a name");
  13. }
  14. options = assign({}, xmldec, doctype, options);
  15. doc = new XMLDocument(options);
  16. root = doc.element(name);
  17. if (!options.headless) {
  18. doc.declaration(options);
  19. if ((options.pubID != null) || (options.sysID != null)) {
  20. doc.doctype(options);
  21. }
  22. }
  23. return root;
  24. };
  25. module.exports.begin = function(options, onData, onEnd) {
  26. var ref1;
  27. if (isFunction(options)) {
  28. ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
  29. options = {};
  30. }
  31. if (onData) {
  32. return new XMLDocumentCB(options, onData, onEnd);
  33. } else {
  34. return new XMLDocument(options);
  35. }
  36. };
  37. module.exports.stringWriter = function(options) {
  38. return new XMLStringWriter(options);
  39. };
  40. module.exports.streamWriter = function(stream, options) {
  41. return new XMLStreamWriter(stream, options);
  42. };
  43. }).call(this);