Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
codenirvana committed Jul 11, 2022
2 parents f66d931 + 4145c4a commit e7a6b3f
Show file tree
Hide file tree
Showing 7 changed files with 1,230 additions and 645 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ node_js:

jobs:
include:
# run tests in Node.js stable and publish code coverage
# run tests in latest LTS Node.js release and publish code coverage
- name: 'Coverage'
os: linux
node_js: stable
node_js: lts/*
script:
- npm run test-unit
- npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2.1.0:
date: 2022-07-11
new features:
- GH-603 Added support for `bridge.once`
chores:
- Run Travis coverage step in latest LTS Node.js release
- GH-604 Updated Flatted dependency
- Updated dependencies

2.0.2:
date: 2021-04-25
chores:
Expand Down
11 changes: 9 additions & 2 deletions lib/bridge-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function (bootCode) {
return `;
(function (emit) {
/*! (c) 2020 Andrea Giammarchi, (ISC) */
var Flatted=function(n){"use strict";var t=JSON.parse,r=JSON.stringify,e=Object.keys,a=String,u="string",f={},i="object",c=function(n,t){return t},l=function(n){return n instanceof a?a(n):n},o=function(n,t){return typeof t===u?new a(t):t},s=function(n,t,r){var e=a(t.push(r)-1);return n.set(r,e),e};return n.parse=function(n,r){var u=t(n,o).map(l),s=u[0],p=r||c,v=typeof s===i&&s?function n(t,r,u,c){for(var l=[],o=e(u),s=o.length,p=0;p<s;p++){var v=o[p],y=u[v];if(y instanceof a){var g=t[y];typeof g!==i||r.has(g)?u[v]=c.call(u,v,g):(r.add(g),u[v]=f,l.push({k:v,a:[t,r,g,c]}))}else u[v]!==f&&(u[v]=c.call(u,v,y))}for(var h=l.length,d=0;d<h;d++){var w=l[d],O=w.k,S=w.a;u[O]=c.call(u,O,n.apply(null,S))}return u}(u,new Set,s,p):s;return p.call({"":v},"",v)},n.stringify=function(n,t,e){for(var a=t&&typeof t===i?function(n,r){return""===n||-1<t.indexOf(n)?r:void 0}:t||c,f=new Map,l=[],o=[],p=+s(f,l,a.call({"":n},"",n)),v=!p;p<l.length;)v=!0,o[p]=r(l[p++],y,e);return"["+o.join(",")+"]";function y(n,t){if(v)return v=!v,t;var r=a.call(this,n,t);switch(typeof r){case i:if(null===r)return r;case u:return f.get(r)||s(f,l,r)}return r}},n}({});
var Flatted=function(n){"use strict";function t(n){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},t(n)}var r=JSON.parse,e=JSON.stringify,o=Object.keys,u=String,f="string",i={},c="object",a=function(n,t){return t},l=function(n){return n instanceof u?u(n):n},s=function(n,r){return t(r)===f?new u(r):r},y=function n(r,e,f,a){for(var l=[],s=o(f),y=s.length,p=0;p<y;p++){var v=s[p],S=f[v];if(S instanceof u){var b=r[S];t(b)!==c||e.has(b)?f[v]=a.call(f,v,b):(e.add(b),f[v]=i,l.push({k:v,a:[r,e,b,a]}))}else f[v]!==i&&(f[v]=a.call(f,v,S))}for(var m=l.length,g=0;g<m;g++){var h=l[g],O=h.k,d=h.a;f[O]=a.call(f,O,n.apply(null,d))}return f},p=function(n,t,r){var e=u(t.push(r)-1);return n.set(r,e),e},v=function(n,e){var o=r(n,s).map(l),u=o[0],f=e||a,i=t(u)===c&&u?y(o,new Set,u,f):u;return f.call({"":i},"",i)},S=function(n,r,o){for(var u=r&&t(r)===c?function(n,t){return""===n||-1<r.indexOf(n)?t:void 0}:r||a,i=new Map,l=[],s=[],y=+p(i,l,u.call({"":n},"",n)),v=!y;y<l.length;)v=!0,s[y]=e(l[y++],S,o);return"["+s.join(",")+"]";function S(n,r){if(v)return v=!v,r;var e=u.call(this,n,r);switch(t(e)){case c:if(null===e)return e;case f:return i.get(e)||p(i,l,e)}return e}};return n.fromJSON=function(n){return v(e(n))},n.parse=v,n.stringify=S,n.toJSON=function(n){return r(S(n))},n}({});
/*! (C) Postdot Technologies, Inc (Apache-2.0) */
var arrayProtoSlice = Array.prototype.slice;
Expand All @@ -31,7 +31,7 @@ module.exports = function (bootCode) {
emit: function (name) {
var self = this,
args = arrayProtoSlice.call(arguments, 1);
this._events[name] && this._events[name].forEach(function (listener) {
this._events[name] && [...this._events[name]].forEach(function (listener) {
listener.apply(self, args);
});
},
Expand All @@ -46,6 +46,13 @@ module.exports = function (bootCode) {
this._events[name].push(listener);
},
once: function (name, listener) {
bridge.on(name, function fn () {
bridge.off(name, fn);
listener.apply(this, arguments);
});
},
off: function (name, listener) {
var e = this._events[name],
i = e && e.length || 0;
Expand Down
Loading

0 comments on commit e7a6b3f

Please sign in to comment.