summaryrefslogtreecommitdiffstats
path: root/app/my-lib.js.map
blob: 39c8bcb43a0dcaf51bf14f030975b0f3c41084dd (plain)
1
{"version":3,"sources":["webpack:///webpack/bootstrap 0dc732a7e702b048798a","webpack:///./src/index.ts","webpack:///./src/base-pubsub.ts"],"names":[],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;AChEA,2CAAyC;AAIzC;IAA0C,gCAAU;IAClD,sBAAY,QAAiB,EAAE,SAAkB,EAAE,YAA+B;QAAlF,YACE,kBAAM,QAAQ,CAAC,SAGhB;QAFC,KAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACnD,KAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;;IAC/B,CAAC;IAEM,gCAAS,GAAhB,UAAiB,YAA+B;QAC9C,IAAM,YAAY,GAAG;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,YAAY,IAAI,EAAE;SACjC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAC/C,CAAC;IAEM,kCAAW,GAAlB;QACE,IAAM,cAAc,GAAG;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;IACnD,CAAC;IAC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;yBACD,WAAW;yBACX,OAAO,CAAC,UAAC,UAAwB,EAAE,YAAqB;wBACvD,IAAI,KAAI,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,KAAI,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;4BACxG,IAAM,yBAAuB,GAAG,UAAC,SAAS,EAAE,KAAoB;gCAApB,4CAAoB;gCAC9D,IAAI,SAAS,CAAC,IAAI,KAAK,kBAAkB,EAAE;oCACzC,qBAAmB,CAAC,KAAK,CAAC,CAAC;iCAC5B;gCACD,KAAI,CAAC,GAAG,CAAC,yBAAuB,CAAC,CAAC;4BACpC,CAAC,CAAC;4BACF,KAAI,CAAC,EAAE,CAAC,yBAAuB,CAAC,CAAC;yBAClC;6BAAM;4BACL,qBAAmB,CAAC,YAAY,CAAC,CAAC;yBACnC;oBACH,CAAC,CAAC,CAAC;iBACN;qBAAM;oBACL,UAAU,EAAE,CAAC;iBACd;YACH,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC;IACJ,CAAC;IAEH,iBAAC;AAAD,CAAC;AA3HY,gCAAU","file":"my-lib.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0dc732a7e702b048798a","import {BasePubSub} from './base-pubsub';\r\n\r\ndeclare const window : Window;\r\n\r\nexport default class PluginPubSub extends BasePubSub {\r\n  constructor(pluginId : string, parentUrl : string, eventsToWait?: Array < string >) {\r\n    super(pluginId);\r\n    this.register('sdc-hub', window.parent, parentUrl);\r\n    this.subscribe(eventsToWait);\r\n  }\r\n\r\n  public subscribe(eventsToWait?: Array < string >) {\r\n    const registerData = {\r\n      pluginId: this.clientId,\r\n      eventsToWait: eventsToWait || []\r\n    };\r\n\r\n    this.notify('PLUGIN_REGISTER', registerData);\r\n  }\r\n\r\n  public unsubscribe() {\r\n    const unregisterData = {\r\n      pluginId: this.clientId\r\n    };\r\n\r\n    this.notify('PLUGIN_UNREGISTER', unregisterData);\r\n  }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","declare const window : Window;\r\n\r\nexport interface IPubSubEvent {\r\n  type : string;\r\n  originId : string;\r\n  data : any;\r\n}\r\n\r\nexport interface ISubscriber {\r\n  window : Window;\r\n  locationUrl : string;\r\n}\r\n\r\nexport class BasePubSub {\r\n  subscribers : Map < string,\r\n  ISubscriber >;\r\n  eventsCallbacks : Array < Function >;\r\n  clientId : string;\r\n  eventsToWait : Map < string,\r\n  Array < string >>;\r\n\r\n  constructor(pluginId : string) {\r\n    this.subscribers = new Map < string,\r\n    ISubscriber > ();\r\n    this.eventsCallbacks = [];\r\n    this.eventsToWait = new Map < string,\r\n    Array < string >> ();\r\n    this.clientId = pluginId;\r\n    this.onMessage = this\r\n      .onMessage\r\n      .bind(this);\r\n\r\n    window.addEventListener('message', this.onMessage);\r\n  }\r\n\r\n  onMessage(event : any) {\r\n    if (this.subscribers.has(event.data.originId)) {\r\n      this\r\n        .eventsCallbacks\r\n        .forEach((callback : Function) => {\r\n          callback(event.data, event);\r\n        });\r\n    }\r\n  }\r\n\r\n  public register(subscriberId : string, subscriberWindow : Window, subscriberUrl : string) {\r\n    const subscriber = {\r\n      window: subscriberWindow,\r\n      locationUrl: subscriberUrl || subscriberWindow.location.href\r\n    };\r\n\r\n    this\r\n      .subscribers\r\n      .set(subscriberId, subscriber);\r\n  }\r\n\r\n  public unregister(subscriberId : string) {\r\n    this\r\n      .subscribers\r\n      .delete(subscriberId);\r\n  }\r\n\r\n  public on(callback : Function) {\r\n    const functionExists = this\r\n      .eventsCallbacks\r\n      .find((func : Function) => {\r\n        return callback.toString() === func.toString();\r\n      });\r\n\r\n    if (!functionExists) {\r\n      this\r\n        .eventsCallbacks\r\n        .push(callback);\r\n    }\r\n  }\r\n\r\n  public off(callback : Function) {\r\n    const index = this\r\n      .eventsCallbacks\r\n      .indexOf(callback);\r\n    this\r\n      .eventsCallbacks\r\n      .splice(index, 1);\r\n  }\r\n\r\n  public notify(eventType : string, eventData?: any) {\r\n    const eventObj = {\r\n      type: eventType,\r\n      data: eventData,\r\n      originId: this.clientId\r\n    };\r\n\r\n    this\r\n      .subscribers\r\n      .forEach((subscriber : ISubscriber, subscriberId : string) => {\r\n        subscriber\r\n          .window\r\n          .postMessage(eventObj, subscriber.locationUrl);\r\n      });\r\n\r\n    return {\r\n      subscribe: function (callbackFn) {\r\n        if (this.subscribers.size !== 0) {\r\n          const subscribersToNotify = Array.from(this.subscribers.keys());\r\n\r\n          const checkNotifyComplete = (subscriberId : string) => {\r\n            const index = subscribersToNotify.indexOf(subscriberId);\r\n            subscribersToNotify.splice(index, 1);\r\n\r\n            if (subscribersToNotify.length === 0) {\r\n              callbackFn();\r\n            }\r\n          };\r\n\r\n          this\r\n            .subscribers\r\n            .forEach((subscriber : ISubscriber, subscriberId : string) => {\r\n              if (this.eventsToWait.has(subscriberId) && this.eventsToWait.get(subscriberId).indexOf(eventType) !== -1) {\r\n                const actionCompletedFunction = (eventData, subId = subscriberId) => {\r\n                  if (eventData.type === 'ACTION_COMPLETED') {\r\n                    checkNotifyComplete(subId);\r\n                  }\r\n                  this.off(actionCompletedFunction);\r\n                };\r\n                this.on(actionCompletedFunction);\r\n              } else {\r\n                checkNotifyComplete(subscriberId);\r\n              }\r\n            });\r\n        } else {\r\n          callbackFn();\r\n        }\r\n      }.bind(this)\r\n    };\r\n  }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/base-pubsub.ts"],"sourceRoot":""}