mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Delete support of onAfterDeserialize_JSB. (#9075)
This commit is contained in:
@@ -465,16 +465,6 @@ class _Deserializer {
|
||||
this.deserializedData = this._deserializeObject(serializedRootObject, 0);
|
||||
}
|
||||
|
||||
if (JSB) {
|
||||
// Invoke hooks
|
||||
const nRefs = this.deserializedList.length;
|
||||
for (let i = 0; i < nRefs; i++) {
|
||||
(this.deserializedList[i] as {
|
||||
onAfterDeserialize_JSB? (): void;
|
||||
} | undefined)?.onAfterDeserialize_JSB?.();
|
||||
}
|
||||
}
|
||||
|
||||
this._serializedData = undefined!;
|
||||
this._mainBinChunk = undefined!;
|
||||
this._context = undefined!;
|
||||
|
||||
@@ -1044,14 +1044,6 @@ export function deserialize (data: IFileData | string | CCON | any, details: Det
|
||||
|
||||
parseResult(data);
|
||||
|
||||
if (JSB) {
|
||||
// invoke hooks
|
||||
for (let i = 0; i < instances.length; ++i) {
|
||||
// try invoking hook on every element regardless of whether the last one is rootIndex
|
||||
instances[i]?.onAfterDeserialize_JSB?.();
|
||||
}
|
||||
}
|
||||
|
||||
res = instances[rootIndex];
|
||||
}
|
||||
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"__type__": "cases.Foo"
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { PORTS_BOTH_DYNAMIC_COMPILED, testEachPort } from "../port";
|
||||
import { ccclassAutoNamed, runTest } from '../utils';
|
||||
|
||||
@ccclassAutoNamed(__dirname)
|
||||
class Foo{
|
||||
numberOfCalls = 0;
|
||||
|
||||
onAfterDeserialize_JSB() {
|
||||
++this.numberOfCalls;
|
||||
}
|
||||
}
|
||||
|
||||
const value = new Foo();
|
||||
|
||||
testEachPort(PORTS_BOTH_DYNAMIC_COMPILED, async (port) => {
|
||||
await runTest(
|
||||
__filename,
|
||||
port,
|
||||
value,
|
||||
(serialized: typeof value) => {
|
||||
expect(serialized.numberOfCalls).toBe(1);
|
||||
},
|
||||
{
|
||||
JSB: true,
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user