amos-tool
Version:
amos ui tool
20 lines (18 loc) • 740 B
JavaScript
;
var objectAssign = require("./../_object.assign"), createTags = function(t) {
return document.createElement(t);
};
module.exports = function(t) {
var e = objectAssign({}, {
method: "post"
}, t), a = createTags("iframe");
a.setAttribute("id", "down-file-iframe");
var r = createTags("form");
for (var i in r.setAttribute("target", "down-file-iframe"), r.setAttribute("method", e.method),
r.setAttribute("action", e.url), e.data) if (Object.prototype.hasOwnProperty.call(e.data, i)) {
var o = createTags("input");
o.setAttribute("type", "hidden"), o.setAttribute("name", i), o.value = e.data[i],
r.appendChild(o);
}
a.appendChild(r), document.body.appendChild(a), r.submit(), a.remove();
};