UNPKG

ngx-bootstrap

Version:
49 lines 3.56 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /*tslint:disable:no-invalid-this */ /* tslint:disable-next-line: no-any */ /** * @param {?=} defaultValue * @return {?} */ export function OnChange(defaultValue) { /** @type {?} */ var sufix = 'Change'; /* tslint:disable-next-line: no-any */ return (/** * @param {?} target * @param {?} propertyKey * @return {?} */ function OnChangeHandler(target, propertyKey) { /** @type {?} */ var _key = " __" + propertyKey + "Value"; Object.defineProperty(target, propertyKey, { /* tslint:disable-next-line: no-any */ get: /* tslint:disable-next-line: no-any */ /** * @return {?} */ function () { return this[_key]; }, /* tslint:disable-next-line: no-any */ set: /* tslint:disable-next-line: no-any */ /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var prevValue = this[_key]; this[_key] = value; if (prevValue !== value && this[propertyKey + sufix]) { this[propertyKey + sufix].emit(value); } } }); }); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjb3JhdG9ycy5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1ib290c3RyYXAvdXRpbHMvIiwic291cmNlcyI6WyJkZWNvcmF0b3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSxNQUFNLFVBQVUsUUFBUSxDQUFDLFlBQWtCOztRQUNuQyxLQUFLLEdBQUcsUUFBUTtJQUV0QixzQ0FBc0M7SUFDdEM7Ozs7O0lBQU8sU0FBUyxlQUFlLENBQUMsTUFBVyxFQUFFLFdBQW1COztZQUN4RCxJQUFJLEdBQUcsUUFBTSxXQUFXLFVBQU87UUFDckMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxNQUFNLEVBQUUsV0FBVyxFQUFFO1lBQ3pDLHNDQUFzQztZQUN0QyxHQUFHOzs7O1lBQUg7Z0JBQ0UsT0FBTyxJQUFJLENBQUMsS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