UNPKG

teams-web-send

Version:

Post messages to Microsoft Teams directly from the browser!

3 lines (2 loc) 1.21 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).tws={})}(this,(function(e){"use strict";e.bootstrap=function(e){var t,n,r,o,a=e||document.body,d=(n=(t=window.navigator.userAgent).indexOf("MSIE "),r=t.indexOf("Trident"),o=t.indexOf("Edge"),n>0||r>0||o>0),s=document.createElement("form");s.style.display="none",s.className="mstws-send-form",s.method="POST",s.enctype="text/plain",s.target="mstws-send-frame";var i=document.createElement("input");i.type="text",i.value='"}';var c,f=document.createElement("iframe");return f.tabIndex=-1,f.name="mstws-send-frame",f.addEventListener("load",(function(){c&&(c(),c=null)})),s.appendChild(i),s.appendChild(f),a.appendChild(s),function(e,t){return new Promise((function(n,r){try{s.action=e;var o=function(e){return e.substring(0,e.lastIndexOf("}")).concat(',"trash": "')}(t);d&&(o=o.replace(/'/g,"\\'").replace(/"/g,"'").replace(/\s\s+/g,""),i.value="'}"),i.name=o,s.submit()}catch(e){console.error(e),r(new Error("Incorrectly formatted message."))}c=n}))}},Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=tws.umd.production.min.js.map