aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 26514622c..d54760100 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -7,6 +7,7 @@ import { DocumentType } from './client/documents/DocumentTypes';
import { Colors } from './client/views/global/globalEnums';
import { Message } from './server/Message';
import * as Color from 'color';
+import { action, makeObservable } from 'mobx';
export namespace Utils {
export let CLICK_TIME = 300;
@@ -439,6 +440,12 @@ export namespace Utils {
socket.on(message, (room: any) => handler(socket, room));
}
}
+export function copyProps(thing: { _prevProps: any; props: any; _props: any }) {
+ Object.keys(thing._prevProps).forEach(action(pkey =>
+ (thing._prevProps as any)[pkey] !== (thing.props as any)[pkey] &&
+ ((thing._props as any)[pkey] = (thing.props as any)[pkey]))); // prettier-ignore
+ thing._prevProps = thing.props;
+}
export function OmitKeys(obj: any, keys: string[], pattern?: string, addKeyFunc?: (dup: any) => void): { omit: any; extract: any } {
const omit: any = { ...obj };