Sha256: 37235332080c42985cb8aeb28c6f9d33046abb1693f6d5cf7bc860d1fa5872c5

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

(function() {
  var faye = '<%= ::Terminus::FAYE_MOUNT %>',
      host = '<%= host %>';
  
  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  = host + '/js.packages.js';
    
    script.onload = script.onreadystatechange = function() {
      var state = script.readyState;
      if (!state || state === 'loaded' || state === 'complete') {
        script.onload = script.onreadystatechange = null;
        head.removeChild(script);
        callback();
      }
    };
    head.appendChild(script);
  };
  
  withPackageManager(function() {
    JS.Packages(function() {
      this.file(host + faye + '/client.js')
        .provides('Faye', 'Faye.Client');
      
      this.file(host + '/terminus.js')
        .requires('Faye.Client')
        .provides('Terminus');
    });
    
    require('Terminus', function() {
      Terminus.connect(host + faye);
    });
  });
})();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terminus-0.1.0 lib/views/bookmarklet.erb