-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): new api useBean & useInject (#45)
* feat(core): new api useBean & useInject * chore(npm): version 0.2.0-alpha * fix: type coverage * docs: code comment * test: update the test snapshot
- Loading branch information
Showing
29 changed files
with
384 additions
and
236 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
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
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
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
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 +1,3 @@ | ||
export const StatedBeanSymbol = Symbol('stated-bean'); | ||
|
||
export const ForceUpdate = Symbol('stated-bean-force-update'); |
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,17 +1,25 @@ | ||
import { getMetadataStorage } from '../metadata'; | ||
|
||
export const PostProvided = (): MethodDecorator => ( | ||
prototype, | ||
propertyKey, | ||
descriptor?: TypedPropertyDescriptor<any>, | ||
) => { | ||
if (descriptor === undefined) { | ||
descriptor = Object.getOwnPropertyDescriptor(prototype, propertyKey)!; | ||
} | ||
getMetadataStorage().collectPostProvided({ | ||
name: propertyKey, | ||
target: prototype.constructor, | ||
descriptor, | ||
}); | ||
return descriptor; | ||
}; | ||
/** | ||
* The `PostProvided` decorator is used on a method that needs to be executed after the StatedBean be instanced to perform any initialization. | ||
* | ||
* @export | ||
* @returns {MethodDecorator} | ||
*/ | ||
export function PostProvided(): MethodDecorator { | ||
return ( | ||
prototype, | ||
propertyKey, | ||
descriptor?: TypedPropertyDescriptor<any>, | ||
) => { | ||
if (descriptor === undefined) { | ||
descriptor = Object.getOwnPropertyDescriptor(prototype, propertyKey)!; | ||
} | ||
getMetadataStorage().collectPostProvided({ | ||
name: propertyKey, | ||
target: prototype.constructor, | ||
descriptor, | ||
}); | ||
return descriptor; | ||
}; | ||
} |
Oops, something went wrong.