@stoplight/command
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -69,2 +69,6 @@ import { Event, IDisposable } from '@stoplight/common/lib/types'; | ||
/** | ||
* Get a handler of specific type or `undefined`. | ||
*/ | ||
getHandler(type: string, commandId: string, ...args: any[]): ICommandHandler | void; | ||
/** | ||
* Get a visible handler for the given command or `undefined`. | ||
@@ -71,0 +75,0 @@ */ |
@@ -261,8 +261,8 @@ "use strict"; | ||
/** | ||
* Get a visible handler for the given command or `undefined`. | ||
* Get a handler of specific type or `undefined`. | ||
*/ | ||
CommandRegistry.prototype.getVisibleHandler = function (commandId) { | ||
CommandRegistry.prototype.getHandler = function (type, commandId) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
args[_i - 2] = arguments[_i]; | ||
} | ||
@@ -273,3 +273,3 @@ var handlers = this._handlers[commandId]; | ||
var handler = handlers_1[_a]; | ||
if (!handler.isVisible || handler.isVisible.apply(handler, args)) { | ||
if (!handler[type] || handler[type].apply(handler, args)) { | ||
return handler; | ||
@@ -281,2 +281,12 @@ } | ||
/** | ||
* Get a visible handler for the given command or `undefined`. | ||
*/ | ||
CommandRegistry.prototype.getVisibleHandler = function (commandId) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
return this.getHandler.apply(this, ['isVisible', commandId].concat(args)); | ||
}; | ||
/** | ||
* Get a handler that is currently executing for the given command or `undefined`. | ||
@@ -289,11 +299,3 @@ */ | ||
} | ||
var handlers = this._handlers[commandId]; | ||
if (handlers) { | ||
for (var _a = 0, handlers_2 = handlers; _a < handlers_2.length; _a++) { | ||
var handler = handlers_2[_a]; | ||
if (handler.isExecuting && handler.isExecuting.apply(handler, args)) { | ||
return handler; | ||
} | ||
} | ||
} | ||
return this.getHandler.apply(this, ['isExecuting', commandId].concat(args)); | ||
}; | ||
@@ -308,11 +310,3 @@ /** | ||
} | ||
var handlers = this._handlers[commandId]; | ||
if (handlers) { | ||
for (var _a = 0, handlers_3 = handlers; _a < handlers_3.length; _a++) { | ||
var handler = handlers_3[_a]; | ||
if (!handler.isEnabled || handler.isEnabled.apply(handler, args)) { | ||
return handler; | ||
} | ||
} | ||
} | ||
return this.getHandler.apply(this, ['isEnabled', commandId].concat(args)); | ||
}; | ||
@@ -319,0 +313,0 @@ /** |
{ | ||
"name": "@stoplight/command", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Stoplight command registry implementation.", | ||
@@ -15,3 +15,2 @@ "main": "lib/index.js", | ||
"prepublishOnly": "yarn build", | ||
"prebuild": "yarn clean", | ||
"build": "NODE_ENV=production yarn build.module", | ||
@@ -21,11 +20,11 @@ "build.module": "tsc --outDir ./lib", | ||
"start": "NODE_ENV=development yarn build.module -w", | ||
"clean": "git clean -fdX .", | ||
"lint": "tslint 'src/**/*.ts'" | ||
"clean": "git clean -fdX ." | ||
}, | ||
"dependencies": { | ||
"@stoplight/common": "^0.0.18", | ||
"@stoplight/ioc": "^0.0.17", | ||
"@stoplight/common": "^0.0.19", | ||
"@stoplight/ioc": "^0.0.19", | ||
"keyboardjs": "2.4.x", | ||
"tslib": "1.x.x" | ||
} | ||
}, | ||
"gitHead": "5651dde9d1be1c234b9282bbc5bc155c47f39e66" | ||
} |
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
26695
519
+ Added@stoplight/common@0.0.19(transitive)
+ Added@stoplight/ioc@0.0.19(transitive)
- Removed@stoplight/common@0.0.18(transitive)
- Removed@stoplight/ioc@0.0.17(transitive)
Updated@stoplight/common@^0.0.19
Updated@stoplight/ioc@^0.0.19