UNPKG

@hardpool/js-bridge

Version:

Bridge between pure vanilla javascript and angular. Expose selected methods of angular component on javascript window object and call them from external javascript application. Making angular app plugable/co-exist with other front end app.

16 lines (14 loc) 3.04 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("@hardpool/js-bridge",["exports","@angular/core"],n):n(((e=e||self).hardpool=e.hardpool||{},e.hardpool["js-bridge"]={}),e.ng.core)}(this,(function(e,n){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function o(e,n,o,r){var t,i=arguments.length,c=i<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,n,o,r);else for(var f=e.length-1;f>=0;f--)(t=e[f])&&(c=(i<3?t(c):i>3?t(n,o,c):t(n,o))||c);return i>3&&c&&Object.defineProperty(n,o,c),c}function r(e,n){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,t,i=o.call(e),c=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)c.push(r.value)}catch(e){t={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(t)throw t.error}}return c}function t(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(r(arguments[n]));return e}var i=function(){function e(){}return e.prototype.ngOnInit=function(){},e=o([n.Component({selector:"hd-js-bridge",template:"\n <p>\n js-bridge works!\n </p>\n "})],e)}(),c=function(){function e(e){this.zone=e}return e.prototype.exposeMethod=function(e,n,o){var r=this;window[n]||(window[n]={}),(o instanceof Array?o:[o]).forEach((function(o){window[n][o]=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return r.zone.run((function(){return e[o].apply(e,t(n))}))}}))},e.prototype.executeMethod=function(e,n){for(var o,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return(o=window[e])[n].apply(o,t(r))},e.ctorParameters=function(){return[{type:n.NgZone}]},e.ɵprov=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(n.NgZone))},token:e,providedIn:"root"}),e=o([n.Injectable({providedIn:"root"})],e)}(),f=function(){function e(){}var r;return r=e,e.forRoot=function(){return{ngModule:r,providers:[c]}},e=r=o([n.NgModule({declarations:[i],imports:[],exports:[]})],e)}();e.JsBridgeModule=f,e.JsBridgeService=c,e.ɵa=i,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=hardpool-js-bridge.umd.min.js.map