mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
global class: add methods
This commit is contained in:
parent
84bd16d4a2
commit
ec14dbdebb
@ -40,22 +40,22 @@ let JAWS = class JAWS {
|
||||
|
||||
// Create registry for actions, with defaults
|
||||
this.actions = {
|
||||
ProjectCreate: null,
|
||||
StageCreate: null,
|
||||
RegionCreate: null,
|
||||
ModuleCreate: null,
|
||||
ModulePostInstall: null,
|
||||
LambdaPackageNodeJs0_10_32: null,
|
||||
LambdaUpload: null,
|
||||
LambdaProvision: null,
|
||||
ApiGatewayProvision: null,
|
||||
ResourcesProvision: null,
|
||||
EnvList: null,
|
||||
EnvGet: null,
|
||||
EnvSet: null,
|
||||
TagResource: null,
|
||||
LambdaRun: null,
|
||||
Dash: null,
|
||||
ProjectCreate: null,
|
||||
StageCreate: null,
|
||||
RegionCreate: null,
|
||||
ModuleCreate: null,
|
||||
ModulePostInstall: null,
|
||||
LambdaPackageNodeJs: null,
|
||||
LambdaUpload: null,
|
||||
LambdaProvision: null,
|
||||
ApiGatewayProvision: null,
|
||||
ResourcesProvision: null,
|
||||
EnvList: null,
|
||||
EnvGet: null,
|
||||
EnvSet: null,
|
||||
TagResource: null,
|
||||
LambdaRun: null,
|
||||
Dash: null,
|
||||
};
|
||||
|
||||
// Create registry for hooks
|
||||
@ -70,8 +70,8 @@ let JAWS = class JAWS {
|
||||
PostModuleCreate: [],
|
||||
PreModulePostInstall: [],
|
||||
PostModulePostInstall: [],
|
||||
PreLambdaPackageNodeJs0_10_32: [],
|
||||
PostLambdaPackageNodeJs0_10_32: [],
|
||||
PreLambdaPackageNodeJs: [],
|
||||
PostLambdaPackageNodeJs: [],
|
||||
PreLambdaUpload: [],
|
||||
PostLambdaUpload: [],
|
||||
PreLambdaProvision: [],
|
||||
@ -119,29 +119,37 @@ let JAWS = class JAWS {
|
||||
* Set Action
|
||||
*/
|
||||
|
||||
action(action, actionGenerator) {
|
||||
action(actionName, actionGenerator) {
|
||||
|
||||
// Check action is valid
|
||||
if (!this.actions[action]) {
|
||||
if (!this.actions[actionName]) {
|
||||
|
||||
}
|
||||
|
||||
this.action = actionGenerator;
|
||||
this.action[actionName] = actionGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Hook
|
||||
*/
|
||||
|
||||
hook(hook, hookGenerator, index) {
|
||||
hook(hookName, hookGenerator, index) {
|
||||
|
||||
// Check hook is valid
|
||||
if (!this.hooks[hook]) {
|
||||
if (!this.hooks[hookName]) {
|
||||
|
||||
}
|
||||
|
||||
index = (!index && index !== 0) ? this.hooks[hook].length : index;
|
||||
this.hooks[hook].splice(index, 0, hookGenerator);
|
||||
index = (!index && index !== 0) ? this.hooks[hookName].length : index;
|
||||
this.hooks[hookName].splice(index, 0, hookGenerator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Plugin
|
||||
*/
|
||||
|
||||
plugin(plugin) {
|
||||
this = plugin(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user