MCPcopy
hub / github.com/tabulator-tables/tabulator / download

Method download

src/js/modules/Download/Download.js:49–80  ·  view source on GitHub ↗
(type, filename, options, range, interceptCallback)

Source from the content-addressed store, hash-verified

47
48 //trigger file download
49 download(type, filename, options, range, interceptCallback){
50 var downloadFunc = false;
51
52 function buildLink(data, mime){
53 if(interceptCallback){
54 if(interceptCallback === true){
55 this.triggerDownload(data, mime, type, filename, true);
56 }else{
57 interceptCallback(data);
58 }
59
60 }else{
61 this.triggerDownload(data, mime, type, filename);
62 }
63 }
64
65 if(typeof type == "function"){
66 downloadFunc = type;
67 }else{
68 if(Download.downloaders[type]){
69 downloadFunc = Download.downloaders[type];
70 }else{
71 console.warn("Download Error - No such download type found: ", type);
72 }
73 }
74
75 if(downloadFunc){
76 var list = this.generateExportList(range);
77
78 downloadFunc.call(this.table, list , options || {}, buildLink.bind(this));
79 }
80 }
81
82 generateExportList(range){
83 var list = this.table.modules.export.generateExportList(this.table.options.downloadConfig, false, range || this.table.options.downloadRowRange, "download");

Callers 3

downloadToTabMethod · 0.95
commsReceivedMethod · 0.95
Download.spec.jsFile · 0.80

Calls 2

generateExportListMethod · 0.95
bindMethod · 0.45

Tested by

no test coverage detected