Sha256: 51b47e642c151681ae559ae449735f59fcc6dbef57374330223fb7fe0f58f424
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
if(window['d3'] === undefined || window['Nyaplot'] === undefined){ var path = <%= dep_libraries.merge(additional_libraries).to_json %>; <% shim = dep_libraries.merge(additional_libraries).inject({}){|hash, (k, v)| hash[k]={exports: k};next hash} %> var shim = <%= shim.to_json %>; require.config({paths: path, shim:shim}); <% str="" dep_libraries.each do |key, val| str.concat("require(['%s'], function(%s){window['%s']=%s;console.log('finished loading %s');"% Array.new(5, key)) end %> <%= str %> var script = d3.select("head") .append("script") .attr("src", "http://cdn.rawgit.com/domitry/Nyaplotjs/master/release/nyaplot.js") .attr("async", true); script[0][0].onload = script[0][0].onreadystatechange = function(){ <% str="" additional_libraries.each do |key, val| str.concat("require(['%s'], function(%s){window['%s']=%s;console.log('finished loading %s');"% Array.new(5, key)) end %> <%= str %> var event = document.createEvent("HTMLEvents"); event.initEvent("load_nyaplot",false,false); window.dispatchEvent(event); console.log('Finished loading Nyaplotjs'); <%= str = Array.new(additional_libraries.length, "});").join("") %> }; <% str = Array.new(dep_libraries.length, "});").join("") %> <%= str %> }
Version data entries
4 entries across 4 versions & 1 rubygems