Created
March 28, 2019 09:57
-
-
Save JonasGao/51fbedc8bde4371c1d400b61931fb76a 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
** | |
* 用于比较属性的帮助方法。应该仅在开发时使用 | |
*/ | |
export const helper = { | |
cache: {}, | |
diff(key: string | number, ...args) { | |
const latestArgs: any[] = this.cache[key]; | |
if (!latestArgs) { | |
this.cache[key] = args; | |
return | |
} | |
latestArgs.forEach((prev, index) => { | |
const next = args[index]; | |
if (prev !== next) { | |
console.log('[key]', key, 'find diff! [index]', index, '[prev]', prev, typeof prev, '[next]', next, typeof next); | |
} | |
}); | |
this.cache[key] = args; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment