htmlfile.js 710 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. var inherits = require('inherits')
  3. , HtmlfileReceiver = require('./receiver/htmlfile')
  4. , XHRLocalObject = require('./sender/xhr-local')
  5. , AjaxBasedTransport = require('./lib/ajax-based')
  6. ;
  7. function HtmlFileTransport(transUrl) {
  8. if (!HtmlfileReceiver.enabled) {
  9. throw new Error('Transport created when disabled');
  10. }
  11. AjaxBasedTransport.call(this, transUrl, '/htmlfile', HtmlfileReceiver, XHRLocalObject);
  12. }
  13. inherits(HtmlFileTransport, AjaxBasedTransport);
  14. HtmlFileTransport.enabled = function(info) {
  15. return HtmlfileReceiver.enabled && info.sameOrigin;
  16. };
  17. HtmlFileTransport.transportName = 'htmlfile';
  18. HtmlFileTransport.roundTrips = 2;
  19. module.exports = HtmlFileTransport;