You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
710 B

4 years ago
  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;