Sha256: 1f101c228f29b81390f674aa82a55aa06316d324029adaeba35253da51d51556

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

(function() {
  var faye   = '<%= ::Terminus::FAYE_MOUNT %>',
      host   = '<%= env['SERVER_NAME'] %>',
      origin = 'http://' + host + ':' + <%= Terminus.port %>;
  
  var withPackageManager = function(callback) {
    if (window.JS && JS.Packages) return callback();
    
    var script = document.createElement('script'),
        head   = document.getElementsByTagName('head')[0];
    
    script.type = 'text/javascript';
    script.src  = origin + '/loader.js';
    
    script.onload = script.onreadystatechange = function() {
      var state = script.readyState;
      if (!state || state === 'loaded' || state === 'complete') {
        script.onload = script.onreadystatechange = null;
        callback();
      }
    };
    head.appendChild(script);
  };
  
  withPackageManager(function() {
    JS.cacheBust = true;
    
    JS.Packages(function() { with(this) {
      file(origin + faye + '/client.js').provides('Faye', 'Faye.Client');
      file(origin + '/compiled/terminus-min.js').requires('Faye.Client').provides('Terminus');
    }});
    
    JS.require('Faye.Client', function() {
      JS.require('Terminus', function() {
        Terminus.connect(host, <%= ::Terminus.port %>);
      });
    });
  });
})();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terminus-0.4.0 lib/terminus/views/bootstrap.erb