summaryrefslogtreecommitdiff
path: root/src/node_modules/inversify/es/annotation/post_construct.js
blob: 5b1ce0954bdca51605c30f1712159a27e30fbf19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import * as ERRORS_MSGS from "../constants/error_msgs";
import * as METADATA_KEY from "../constants/metadata_keys";
import { Metadata } from "../planning/metadata";
function postConstruct() {
    return function (target, propertyKey, descriptor) {
        var 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);
    };
}
export { postConstruct };