MCPcopy Create free account
hub / github.com/cocos/cocos-engine / cloneObject

Function cloneObject

pal/utils.ts:33–41  ·  view source on GitHub ↗
(targetObject: T, originObj: T)

Source from the content-addressed store, hash-verified

31 * @param originObj Original minigame environment such as `wx`, `swan` etc.
32 */
33export function cloneObject<T extends object = any> (targetObject: T, originObj: T): void {
34 Object.keys(originObj).forEach((key) => {
35 if (typeof originObj[key] === 'function') {
36 targetObject[key] = originObj[key].bind(originObj);
37 return;
38 }
39 targetObject[key] = originObj[key];
40 });
41}
42
43type MiningameAudioCallbackName = 'onPlay' | 'onPause' | 'onStop' | 'onSeek';
44type InnerAudioContextPolyfillConfig = {

Callers 9

xiaomi.tsFile · 0.90
baidu.tsFile · 0.90
wechat.tsFile · 0.90
taobao.tsFile · 0.90
bytedance.tsFile · 0.90
runtime.tsFile · 0.90
taobao_minigame.tsFile · 0.90
alipay.tsFile · 0.90

Calls 3

forEachMethod · 0.65
keysMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected