├── .babelrc ├── .gitignore ├── .eslintrc.js ├── webpack.build.config.js ├── package.json ├── README.md ├── src └── VertxEventBus.js └── dist └── vue-vertx3-eventbus-client.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "comments": false 4 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea/ 3 | node_modules/ 4 | coverage/ 5 | npm-debug.log 6 | selenium-debug.log 7 | test/unit/coverage 8 | test/e2e/reports 9 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module', 8 | ecmaVersion: 6, 9 | ecmaFeatures: { 10 | jsx: true 11 | } 12 | }, 13 | env: { 14 | browser: true 15 | }, 16 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 17 | extends: 'standard', 18 | // required to lint *.vue files 19 | plugins: [ 20 | // 'html' 21 | ], 22 | // add your custom rules here 23 | rules: { 24 | // allow async-await 25 | 'generator-star-spacing': 'off', 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 28 | 'comma-dangle': [ 29 | 'error', { 30 | arrays: 'only-multiline', 31 | objects: 'only-multiline', 32 | imports: 'never', 33 | exports: 'never', 34 | functions: 'ignore', 35 | }] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /webpack.build.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const webpack = require('webpack') 3 | const version = require('./package.json').version 4 | const banner = '/**\n' + ' * vue-vertx3-eventbus-client v' + version + '\n' + ' * https://github.com/eraga/vue-vertx3-eventbus-client\n' + ' * Released under the GPL-3.0 License.\n' + ' */\n' 5 | 6 | module.exports = [ 7 | { 8 | devtool: 'source-map', 9 | entry: path.resolve() + '/src/VertxEventBus', 10 | output: { 11 | path: path.resolve() + '/dist', 12 | filename: 'vue-vertx3-eventbus-client.js', 13 | library: 'VueVertxEventBus', 14 | libraryTarget: 'umd', 15 | }, 16 | 17 | plugins: [ 18 | new webpack.optimize.UglifyJsPlugin({ 19 | sourceMap: true, 20 | uglifyOptions: { 21 | output: { 22 | // beautify: true, // comment out or set to false for production 23 | }, 24 | }, 25 | }), 26 | new webpack.BannerPlugin({ 27 | banner: banner, 28 | raw: true, 29 | }), 30 | ], 31 | 32 | module: { 33 | loaders: [ 34 | { 35 | test: /\.js?$/, 36 | exclude: /node_modules/, 37 | loader: 'babel-loader', 38 | }, 39 | { 40 | 'test': /\.vue$/, 41 | 'loader': 'vue', 42 | }, 43 | ], 44 | }, 45 | }, 46 | ] 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-vertx3-eventbus-client", 3 | "version": "3.6.0", 4 | "description": "Vertx3 Eventbus client for Vue.js", 5 | "main": "dist/vue-vertx3-eventbus-client.js", 6 | "dependencies": { 7 | "vertx3-eventbus-client": "^3.9.4" 8 | }, 9 | "devDependencies": { 10 | "babel": "^6.23.0", 11 | "babel-core": "^6.26.3", 12 | "babel-eslint": "^8.2.6", 13 | "babel-loader": "^7.1.5", 14 | "babel-preset-es2015": "^6.24.1", 15 | "eslint": "^4.19.1", 16 | "eslint-config-standard": "^11.0.0", 17 | "eslint-plugin-import": "^2.21.2", 18 | "eslint-plugin-node": "^5.2.1", 19 | "eslint-plugin-promise": "^3.8.0", 20 | "eslint-plugin-standard": "^3.1.0", 21 | "vue": "^2.6.11", 22 | "webpack": "^3.12.0" 23 | }, 24 | "scripts": { 25 | "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs", 26 | "build": "webpack --progress --config webpack.build.config.js", 27 | "test": "echo \"Error: no test specified\" && exit 1" 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git@github.com:eraga/vue-vertx3-eventbus-client.git" 32 | }, 33 | "keywords": [ 34 | "vue.js", 35 | "vertx3", 36 | "eventbus" 37 | ], 38 | "files": [ 39 | "dist", 40 | "src" 41 | ], 42 | "author": "Klaus Schwartz", 43 | "license": "GPL-3.0", 44 | "bugs": { 45 | "url": "https://github.com/eraga/vue-vertx3-eventbus-client/issues" 46 | }, 47 | "homepage": "https://github.com/eraga/vue-vertx3-eventbus-client#readme" 48 | } 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-vertx3-eventbus-client [![NPM version](https://img.shields.io/npm/v/vue-vertx3-eventbus-client.svg)](https://www.npmjs.com/package/vue-vertx3-eventbus-client) 2 | ![VueJS v2.x compatible](https://img.shields.io/badge/vue%202.x-compatible-green.svg) ![VertX v3.6 compatible](https://img.shields.io/badge/VertX%203.6-compatible-green.svg) 3 | 4 | Vertx 3.6 EventBus plugin for VueJS that wraps official [vertx3-eventbus-client@3.6.0](https://www.npmjs.com/package/vertx3-eventbus-client). 5 | 6 | 7 | ## Install 8 | ### NPM 9 | You can install it via [NPM](http://npmjs.org/). 10 | ``` 11 | $ npm install vue-vertx3-eventbus-client 12 | ``` 13 | ### Manual 14 | Download zip package and unpack and add the `vue-vertx3-eventbus-client.js` file to your project from dist folder. 15 | ``` 16 | https://github.com/eraga/vue-vertx3-eventbus-client/archive/master.zip 17 | ``` 18 | 19 | ## Usage 20 | Register the plugin, it will connect to `/` 21 | ```js 22 | import VertxEventBus from 'vue-vertx3-eventbus-client' 23 | Vue.use(VertxEventBus, { path: '/eventbus', port: 8082 }) 24 | ``` 25 | or connect to other address: 26 | ```js 27 | Vue.use(VertxEventBus, { 28 | host: 'www.example.com', 29 | path: '/eventbus' 30 | }) 31 | ``` 32 | It is possible to pass `vertx3-eventbus-client` and `SockJS` options too: 33 | ```js 34 | Vue.use(VertxEventBus, { 35 | path: '/eventbus', 36 | port: 8082, 37 | options: { 38 | transports: [ // whitelist "long polling" and "websocket" Sock JS transports 39 | 'xhr-polling', 40 | 'websocket', 41 | ], 42 | }, 43 | }) 44 | ``` 45 | 46 | 47 | Use it in your components with configuration at `eventbus` section: 48 | ```html 49 | 91 | ``` 92 | 93 | `lifecycleHooks` are executed together with corresponding Vue hooks: `created`, `mounted`, etc. 94 | Put your `handler` objects to `handlers` section. They will be registered at `beforeCreate` and unregistered at `beforeDestroy`. 95 | 96 | 97 | EventBusClient object can be reached with `this.$eventBus`: 98 | ```html 99 | 132 | ``` 133 | 134 | ## Build 135 | This command will build a distributable version in the `dist` directory. 136 | ```bash 137 | npm run build 138 | ``` 139 | 140 | ## Contribution 141 | Pull requests improving the usage and fixing bugs are welcome! 142 | 143 | ## Contact 144 | 145 | Copyleft © 2018 eRaga Infosystems and @tntclaus 146 | 147 | [![@eraga](https://img.shields.io/badge/github-eraga-blue.svg)](https://github.com/eraga) [![@eraga](https://img.shields.io/badge/www-eraga.net-orange.svg)](https://www.eraga.net/) 148 | -------------------------------------------------------------------------------- /src/VertxEventBus.js: -------------------------------------------------------------------------------- 1 | import EventBus from 'vertx3-eventbus-client' 2 | 3 | // noinspection JSUnusedGlobalSymbols 4 | export default { 5 | install (Vue, config) { 6 | config = config || {} 7 | config.schema = config.schema || window.location.protocol 8 | config.host = config.host || window.location.hostname 9 | config.port = config.port || window.location.port 10 | config.path = config.path || '' 11 | config.options = config.options || {} 12 | 13 | let address = config.schema + '//' + config.host + ':' + config.port + config.path 14 | 15 | let eb = new EventBus(address, config.options) 16 | // noinspection JSUnusedGlobalSymbols 17 | Vue.prototype.$eventBus = eb 18 | 19 | eb.onclose = function () { 20 | console.log('eb closed!!!') 21 | handlersToReg = [] 22 | handlersToUnReg = [] 23 | } 24 | 25 | /** 26 | * Directives 27 | */ 28 | 29 | /** 30 | * v-eb-handler:address.data="tableData" 31 | * v-eb-handler:address.method="ebCallback" 32 | * v-eb-handler:address="{headers:{}, data: tableData, method: ebCallback}" 33 | */ 34 | // Vue.directive('eb-handler', { 35 | // bind (el, binding, vnode, oldVnode) { 36 | // if (binding.modifiers.data && binding.modifiers.method) { 37 | // throw new TypeError('can`t have both data and method binding.modifiers', binding.modifiers) 38 | // } 39 | // 40 | // let handler = {} 41 | // 42 | // handler.address = binding.arg 43 | // 44 | // console.log(vnode.context.$options) 45 | // if (binding.modifiers.data) { 46 | // console.log('data', binding.value) 47 | // } else if (binding.modifiers.method) { 48 | // console.log('meth', binding.value) 49 | // } else { 50 | // console.log('json', binding.value, binding.expression) 51 | // } 52 | // 53 | // handler.headers = binding.expression 54 | // handler.callback = binding.modifiers[0] 55 | // console.log(handler, binding.modifiers) 56 | // eb.registerHandler(handler.address, handler.headers, handler.callback) 57 | // }, 58 | // unbind (el, binding, vnode, oldVnode) { 59 | // // 60 | // }, 61 | // }) 62 | 63 | /** 64 | * Mixin methods 65 | */ 66 | 67 | let hooks = [] 68 | let handlersToReg = [] 69 | let handlersToUnReg = [] 70 | 71 | let regHandlers = function (handler) { 72 | eb.registerHandler(handler.address, handler.headers, handler.callback) 73 | } 74 | 75 | let unRegHandlers = function (handler) { 76 | eb.unregisterHandler(handler.address, handler.headers, handler.callback) 77 | } 78 | 79 | let ebOnOpen = function () { 80 | hooks.forEach((hook) => { 81 | hook.hook(hook.context, eb) 82 | }) 83 | 84 | handlersToReg.forEach(regHandlers) 85 | 86 | handlersToUnReg.forEach(unRegHandlers) 87 | } 88 | 89 | function safeExecuteHook (hook, context) { 90 | if (eb.state === EventBus.OPEN) { 91 | hook(context, eb) 92 | } else { 93 | hooks.push({ 94 | hook: hook, 95 | context: context, 96 | }) 97 | eb.onopen = ebOnOpen 98 | } 99 | } 100 | 101 | let addHandlers = function (context) { 102 | if (!context.$options['eventbus'].handlers) { 103 | return 104 | } 105 | let handlers = context.$options['eventbus'].handlers 106 | 107 | if (eb.state === EventBus.OPEN) { 108 | handlers.forEach(regHandlers) 109 | } else { 110 | handlersToReg = handlersToReg.concat(handlers) 111 | eb.onopen = ebOnOpen 112 | } 113 | } 114 | 115 | let removeHandlers = function (context) { 116 | if (!context.$options['eventbus'].handlers) { 117 | return 118 | } 119 | let handlers = context.$options['eventbus'].handlers 120 | 121 | if (eb.state === EventBus.OPEN) { 122 | handlers.forEach(unRegHandlers) 123 | } else { 124 | handlersToUnReg = handlersToUnReg.concat(handlers) 125 | eb.onopen = ebOnOpen 126 | } 127 | } 128 | 129 | let runLifecicleHook = function (context, hookName) { 130 | if (!context.$options['eventbus'].lifecycleHooks) { 131 | return 132 | } 133 | 134 | if (context.$options['eventbus'].lifecycleHooks[hookName]) { 135 | safeExecuteHook(context.$options['eventbus'].lifecycleHooks[hookName], context) 136 | } 137 | } 138 | 139 | let beforeCreate = function () { 140 | if (!this.$options['eventbus']) { 141 | return 142 | } 143 | 144 | runLifecicleHook(this, 'beforeCreate') 145 | addHandlers(this) 146 | } 147 | 148 | let created = function () { 149 | if (!this.$options['eventbus']) { 150 | return 151 | } 152 | 153 | runLifecicleHook(this, 'created') 154 | } 155 | 156 | let beforeMount = function () { 157 | if (!this.$options['eventbus']) { 158 | return 159 | } 160 | 161 | runLifecicleHook(this, 'beforeMount') 162 | } 163 | 164 | let mounted = function () { 165 | if (!this.$options['eventbus']) { 166 | return 167 | } 168 | 169 | runLifecicleHook(this, 'mounted') 170 | } 171 | 172 | let beforeUpdate = function () { 173 | if (!this.$options['eventbus']) { 174 | return 175 | } 176 | 177 | runLifecicleHook(this, 'beforeUpdate') 178 | } 179 | 180 | let updated = function () { 181 | if (!this.$options['eventbus']) { 182 | return 183 | } 184 | 185 | runLifecicleHook(this, 'updated') 186 | } 187 | 188 | let beforeDestroy = function () { 189 | if (!this.$options['eventbus']) { 190 | return 191 | } 192 | 193 | runLifecicleHook(this, 'beforeDestroy') 194 | 195 | removeHandlers(this) 196 | } 197 | let destroyed = function () { 198 | if (!this.$options['eventbus']) { 199 | return 200 | } 201 | 202 | runLifecicleHook(this, 'destroyed') 203 | } 204 | 205 | Vue.mixin({ 206 | beforeCreate: beforeCreate, 207 | created: created, 208 | beforeMount: beforeMount, 209 | mounted: mounted, 210 | beforeUpdate: beforeUpdate, 211 | updated: updated, 212 | beforeDestroy: beforeDestroy, 213 | destroyed: destroyed, 214 | }) 215 | }, 216 | } 217 | -------------------------------------------------------------------------------- /dist/vue-vertx3-eventbus-client.js: -------------------------------------------------------------------------------- 1 | /** 2 | * vue-vertx3-eventbus-client v3.6.0 3 | * https://github.com/eraga/vue-vertx3-eventbus-client 4 | * Released under the GPL-3.0 License. 5 | */ 6 | 7 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueVertxEventBus=e():t.VueVertxEventBus=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=33)}([function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function i(t){if(f===clearTimeout)return clearTimeout(t);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function s(){m&&p&&(m=!1,p.length?d=p.concat(d):v=-1,d.length&&a())}function a(){if(!m){var t=o(s);m=!0;for(var e=d.length;e;){for(p=d,d=[];++v1)for(var n=1;n=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),e.splice(o,0,n)}}function a(){var t;return"object"===("undefined"==typeof console?"undefined":o(console))&&console.log&&(t=console).log.apply(t,arguments)}function c(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}}function u(){var t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&void 0!==r&&"env"in r&&(t=r.env.DEBUG),t}e.log=a,e.formatArgs=s,e.save=c,e.load=u,e.useColors=i,e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=n(41)(e),t.exports.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(e,n(1))},function(t,e,n){"use strict";function r(){i.call(this)}var o=n(0),i=n(20);o(r,i),r.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},r.prototype.once=function(t,e){function n(){r.removeListener(t,n),o||(o=!0,e.apply(this,arguments))}var r=this,o=!1;this.on(t,n)},r.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,r=new Array(n-1),o=1;o1)))/4)-x((t-1901+e)/100)+x((t-1601+e)/400)};if((d=y.hasOwnProperty)||(d=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?d=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,d=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,d.call(this,t)}),m=function(t,e){var n,r,o,i=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(o in r)d.call(r,o)&&i++;return n=r=null,i?m=2==i?function(t,e){var n,r={},o="[object Function]"==b.call(t);for(n in t)o&&"prototype"==n||d.call(r,n)||!(r[n]=1)||!d.call(t,n)||e(n)}:function(t,e){var n,r,o="[object Function]"==b.call(t);for(n in t)o&&"prototype"==n||!d.call(t,n)||(r="constructor"===n)||e(n);(r||d.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],m=function(t,e){var n,o,i="[object Function]"==b.call(t),s=!i&&"function"!=typeof t.constructor&&a[typeof t.hasOwnProperty]&&t.hasOwnProperty||d;for(n in t)i&&"prototype"==n||!s.call(t,n)||e(n);for(o=r.length;n=r[--o];s.call(t,n)&&e(n));}),m(t,e)},!n("json-stringify")){var C={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},O=function(t,e){return("000000"+(e||0)).slice(-t)},T=function(t){for(var e='"',n=0,r=t.length,o=!w||r>10,i=o&&(w?t.split(""):t);n-1/0&&a<1/0){if(E){for(h=x(a/864e5),u=x(h/365.2425)+1970-1;E(u+1,0)<=h;u++);for(l=x((h-E(u,0))/30.42);E(u,l+1)<=h;l++);h=1+h-E(u,l),p=(a%864e5+864e5)%864e5,y=x(p/36e5)%24,g=x(p/6e4)%60,w=x(p/1e3)%60,_=p%1e3}else u=a.getUTCFullYear(),l=a.getUTCMonth(),h=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),_=a.getUTCMilliseconds();a=(u<=0||u>=1e4?(u<0?"-":"+")+O(6,u<0?-u:u):O(4,u))+"-"+O(2,l+1)+"-"+O(2,h)+"T"+O(2,y)+":"+O(2,g)+":"+O(2,w)+"."+O(3,_)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if("[object Boolean]"==(c=b.call(a)))return""+a;if("[object Number]"==c)return a>-1/0&&a<1/0?""+a:"null";if("[object String]"==c)return T(""+a);if("object"==typeof a){for(k=s.length;k--;)if(s[k]===a)throw f();if(s.push(a),C=[],A=i,i+=o,"[object Array]"==c){for(j=0,k=a.length;j0)for(r="",n>10&&(n=10);r.length=48&&o<=57||o>=97&&o<=102||o>=65&&o<=70||I();t+=k("0x"+i.slice(e,N));break;default:I()}else{if(34==o)break;for(o=i.charCodeAt(N),e=N;o>=32&&92!=o&&34!=o;)o=i.charCodeAt(++N);t+=i.slice(e,N)}if(34==i.charCodeAt(N))return N++,t;I();default:if(e=N,45==o&&(r=!0,o=i.charCodeAt(++N)),o>=48&&o<=57){for(48==o&&(o=i.charCodeAt(N+1))>=48&&o<=57&&I(),r=!1;N=48&&o<=57;N++);if(46==i.charCodeAt(N)){for(n=++N;n=48&&o<=57;n++);n==N&&I(),N=n}if(101==(o=i.charCodeAt(N))||69==o){for(o=i.charCodeAt(++N),43!=o&&45!=o||N++,n=N;n=48&&o<=57;n++);n==N&&I(),N=n}return+i.slice(e,N)}if(r&&I(),"true"==i.slice(N,N+4))return N+=4,!0;if("false"==i.slice(N,N+5))return N+=5,!1;if("null"==i.slice(N,N+4))return N+=4,null;I()}return"$"},D=function(t){var e,n;if("$"==t&&I(),"string"==typeof t){if("@"==(w?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];"]"!=(t=F());n||(n=!0))n&&(","==t?"]"==(t=F())&&I():I()),","==t&&I(),e.push(D(t));return e}if("{"==t){for(e={};"}"!=(t=F());n||(n=!0))n&&(","==t?"}"==(t=F())&&I():I()),","!=t&&"string"==typeof t&&"@"==(w?t.charAt(0):t[0])&&":"==F()||I(),e[t.slice(1)]=D(F());return e}I()}return t},P=function(t,e,n){var r=L(t,e,n);r===v?delete t[e]:t[e]=r},L=function(t,e,n){var r,o=t[e];if("object"==typeof o&&o)if("[object Array]"==b.call(o))for(r=o.length;r--;)P(o,r,n);else m(o,function(t){P(o,t,n)});return n.call(t,e,o)};e.parse=function(t,e){var n,r;return N=0,j=""+t,n=D(F()),"$"!=F()&&I(),N=j=null,e&&"[object Function]"==b.call(e)?L((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var s=n(49),a={function:!0,object:!0},c=a[typeof e]&&e&&!e.nodeType&&e,u=a[typeof window]&&window||this,l=c&&a[typeof t]&&t&&!t.nodeType&&"object"==typeof r&&r;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),c&&!s)i(u,c);else{var f=u.JSON,h=u.JSON3,p=!1,d=i(u,u.JSON3={noConflict:function(){return p||(p=!0,u.JSON=f,u.JSON3=h,f=h=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}s&&void 0!==(o=function(){return d}.call(e,n,e,t))&&(t.exports=o)}).call(this)}).call(e,n(48)(t),n(2))},function(t,e,n){"use strict";(function(e){var r=n(8),o={},i=!1,s=e.chrome&&e.chrome.app&&e.chrome.app.runtime;t.exports={attachEvent:function(t,n){void 0!==e.addEventListener?e.addEventListener(t,n,!1):e.document&&e.attachEvent&&(e.document.attachEvent("on"+t,n),e.attachEvent("on"+t,n))},detachEvent:function(t,n){void 0!==e.addEventListener?e.removeEventListener(t,n,!1):e.document&&e.detachEvent&&(e.document.detachEvent("on"+t,n),e.detachEvent("on"+t,n))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return o[e]=t,i&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in o&&delete o[t]},triggerUnloadCallbacks:function(){for(var t in o)o[t](),delete o[t]}};var a=function(){i||(i=!0,t.exports.triggerUnloadCallbacks())};s||t.exports.attachEvent("unload",a)}).call(e,n(2))},function(t,e,n){"use strict";var r=n(38),o="abcdefghijklmnopqrstuvwxyz012345";t.exports={string:function(t){for(var e=o.length,n=r.randomBytes(t),i=[],s=0;s