@nextcloud/event-bus
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -24,2 +24,3 @@ export declare const name: string; | ||
"core-js": string; | ||
"semver": string; | ||
}; | ||
@@ -26,0 +27,0 @@ export declare const devDependencies: { |
@@ -8,2 +8,6 @@ "use strict"; | ||
var _semver = _interopRequireDefault(require("semver")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -19,3 +23,3 @@ | ||
name: "@nextcloud/event-bus", | ||
version: "1.0.0", | ||
version: "1.0.1", | ||
description: "", | ||
@@ -41,3 +45,4 @@ main: "dist/index.js", | ||
dependencies: { | ||
"core-js": "^3.1.4" | ||
"core-js": "^3.1.4", | ||
semver: "^7.1.1" | ||
}, | ||
@@ -68,4 +73,5 @@ devDependencies: { | ||
if (bus.getVersion() !== this.getVersion()) { | ||
// TODO: only warn if major version number does not match | ||
if (typeof bus.getVersion !== 'function' || !_semver.default.valid(bus.getVersion())) { | ||
console.warn('Proxying an event bus with an unknown or invalid version'); | ||
} else if (_semver.default.major(bus.getVersion()) !== _semver.default.major(this.getVersion())) { | ||
console.warn('Proxying an event bus of version ' + bus.getVersion() + ' with ' + this.getVersion()); | ||
@@ -72,0 +78,0 @@ } |
@@ -34,3 +34,3 @@ "use strict"; | ||
name: "@nextcloud/event-bus", | ||
version: "1.0.0", | ||
version: "1.0.1", | ||
description: "", | ||
@@ -56,3 +56,4 @@ main: "dist/index.js", | ||
dependencies: { | ||
"core-js": "^3.1.4" | ||
"core-js": "^3.1.4", | ||
semver: "^7.1.1" | ||
}, | ||
@@ -59,0 +60,0 @@ devDependencies: { |
@@ -0,1 +1,3 @@ | ||
import semver from 'semver'; | ||
import packageJson from "../package.json"; | ||
@@ -11,4 +13,5 @@ import { Event } from "./Event.js"; | ||
constructor(bus: EventBus) { | ||
if (bus.getVersion() !== this.getVersion()) { | ||
// TODO: only warn if major version number does not match | ||
if (typeof bus.getVersion !== 'function' || !semver.valid(bus.getVersion())) { | ||
console.warn('Proxying an event bus with an unknown or invalid version') | ||
} else if (semver.major(bus.getVersion()) !== semver.major(this.getVersion())) { | ||
console.warn('Proxying an event bus of version ' + bus.getVersion() + ' with ' + this.getVersion()) | ||
@@ -15,0 +18,0 @@ } |
{ | ||
"name": "@nextcloud/event-bus", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -26,3 +26,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"core-js": "^3.1.4" | ||
"core-js": "^3.1.4", | ||
"semver": "^7.1.1" | ||
}, | ||
@@ -29,0 +30,0 @@ "devDependencies": { |
import { emit, subscribe, unsubscribe } from '../lib/index' | ||
test('readme example', () => { | ||
const h = jest.fn(e => console.info(e)) | ||
const h = jest.fn() | ||
@@ -18,3 +18,3 @@ subscribe('a', h) | ||
test('unsubscribe', () => { | ||
const h = jest.fn(e => console.info(e)) | ||
const h = jest.fn() | ||
@@ -21,0 +21,0 @@ subscribe('a', h) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
541490
58
2357
2
2
+ Addedsemver@^7.1.1
+ Addedsemver@7.6.3(transitive)