Last active
August 28, 2019 03:45
-
-
Save vhqtvn/e0e379b01ff9cd8f8266399e28d7bb68 to your computer and use it in GitHub Desktop.
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
/* tslint:disable */ | |
export function NoObserver<T>(target: T): T { | |
if (target === null || typeof target === 'undefined') { | |
return target; | |
} | |
(target as any)._isVue = true; | |
return target; | |
} | |
export function NoReactiveProp(): PropertyDecorator { | |
return (target: Object, propertyKey: string | symbol) => { | |
Object.defineProperty((target as any), propertyKey, { | |
get: function () { | |
return this[`__noreactive__${propertyKey.toString()}`]; | |
}, | |
set: function (val: any) { | |
this[`__noreactive__${propertyKey.toString()}`] = NoObserver(val); | |
}, | |
}); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment