-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1132 from parisholley/async-v2
Promise (Lazy) Support + Global onActivation/onDeactivation
- Loading branch information
Showing
39 changed files
with
3,599 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ test/**/*.js.map | |
src/**/*.js.map | ||
src/*.js.map | ||
type_definitions/**/*.js | ||
.DS_store | ||
.idea | ||
|
||
.nyc_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import * as ERRORS_MSGS from "../constants/error_msgs"; | ||
import * as METADATA_KEY from "../constants/metadata_keys"; | ||
import { Metadata } from "../planning/metadata"; | ||
import { propertyEventDecorator } from "./property_event_decorator"; | ||
|
||
function postConstruct() { | ||
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) { | ||
const metadata = new Metadata(METADATA_KEY.POST_CONSTRUCT, propertyKey); | ||
|
||
if (Reflect.hasOwnMetadata(METADATA_KEY.POST_CONSTRUCT, target.constructor)) { | ||
throw new Error(ERRORS_MSGS.MULTIPLE_POST_CONSTRUCT_METHODS); | ||
} | ||
Reflect.defineMetadata(METADATA_KEY.POST_CONSTRUCT, metadata, target.constructor); | ||
}; | ||
} | ||
const postConstruct = propertyEventDecorator( | ||
METADATA_KEY.POST_CONSTRUCT, | ||
ERRORS_MSGS.MULTIPLE_POST_CONSTRUCT_METHODS, | ||
); | ||
|
||
export { postConstruct }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as ERRORS_MSGS from "../constants/error_msgs"; | ||
import * as METADATA_KEY from "../constants/metadata_keys"; | ||
import { propertyEventDecorator } from "./property_event_decorator"; | ||
|
||
const preDestroy = propertyEventDecorator( | ||
METADATA_KEY.PRE_DESTROY, | ||
ERRORS_MSGS.MULTIPLE_PRE_DESTROY_METHODS, | ||
); | ||
|
||
export { preDestroy }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Metadata } from "../planning/metadata"; | ||
|
||
function propertyEventDecorator(eventKey: string, errorMessage: string) { | ||
return () => { | ||
return (target: any, propertyKey: string) => { | ||
const metadata = new Metadata(eventKey, propertyKey); | ||
|
||
if (Reflect.hasOwnMetadata(eventKey, target.constructor)) { | ||
throw new Error(errorMessage); | ||
} | ||
Reflect.defineMetadata(eventKey, metadata, target.constructor); | ||
} | ||
} | ||
} | ||
|
||
export { propertyEventDecorator } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.