UNPKG

vue-qewd

Version:

Vue.js & Nuxt.js WebSocket client plugin for QEWD.js

220 lines (177 loc) 8.21 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("EWD")); else if(typeof define === 'function' && define.amd) define(["EWD"], factory); else if(typeof exports === 'object') exports["VueQEWD"] = factory(require("EWD")); else root["VueQEWD"] = factory(root["EWD"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_3__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1); /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _index = __webpack_require__(2); exports.QEWD = _index.QEWD; /* ---------------------------------------------------------------------------- | vue-qewd: Vue.js client module for QEWD.js | | | | Copyright (c) 2019 Stabe nv, | | Hofstade, Oost-Vlaanderen, | | All rights reserved. | | | | Licensed under the Apache License, Version 2.0 (the "License"); | | you may not use this file except in compliance with the License. | | You may obtain a copy of the License at | | | | http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | See the License for the specific language governing permissions and | | limitations under the License. | ---------------------------------------------------------------------------- 11 January 2019 */ /* eslint-disable comma-dangle */ /* eslint-disable func-names */ /** * Install plugin. */ exports.VueQEWD = { install: function install(Vue, options) { var qewd = options.qewd; Vue.qewd = qewd; Object.defineProperties(Vue.prototype, { $qewd: { get: function get() { return qewd; } } }); } }; /* // don't enable because (qewd) option need to be passed in! if (typeof window !== 'undefined' && window.Vue) { window.Vue.use(VueQEWD) } */ /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.QEWD = QEWD; var _ewdClient = __webpack_require__(3); var _ewdClient2 = _interopRequireDefault(_ewdClient); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } // instantiation function to use ewd-client function QEWD(params) { // set up start parameters for ewd-client var EWD = _ewdClient2['default'].EWD || _ewdClient2['default']; var application = { application: params.application || 'unknown', io: params.io, $: params.$, ajax: params.ajax || null, url: params.url || null, mode: params.mode || 'development', log: params.log || true, cookieName: params.cookieName || 'ewdSession', jwt: params.jwt || false, jwt_decode: params.jwt_decode || false }; EWD.vstart = EWD.vueStart = function () { EWD.start(application); }; var registrationCallback = null; EWD.vueRegistrationCallback = EWD.vRegistrationCallback = function (callback) { registrationCallback = callback; }; EWD.on('ewd-registered', function () { if (registrationCallback) { registrationCallback(true, 'ewd-registered'); } }); EWD.on('ewd-reregistered', function () { if (registrationCallback) { registrationCallback(true, 'ewd-reregistered'); } }); EWD.on('socketDisconnected', function () { if (registrationCallback) { registrationCallback(false, 'socketDisconnected'); } }); // return the EWD client instance return EWD; } /* ---------------------------------------------------------------------------- | vue-qewd: Vue.js client module for QEWD.js | | | | Copyright (c) 2019 Stabe nv, | | Hofstade, Oost-Vlaanderen, | | All rights reserved. | | | | Licensed under the Apache License, Version 2.0 (the "License"); | | you may not use this file except in compliance with the License. | | You may obtain a copy of the License at | | | | http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | See the License for the specific language governing permissions and | | limitations under the License. | ---------------------------------------------------------------------------- 11 January 2019 */ /* eslint-disable comma-dangle */ /* eslint-disable func-names */ /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }) /******/ ]) }); ;