จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
blockly > fieldRegistry > ลงทะเบียน
ฟังก์ชัน FieldRegistry.register()
ลงทะเบียนประเภทช่อง FieldRegistry.fromJson ใช้รีจิสทรีนี้เพื่อค้นหาประเภทฟิลด์ที่เหมาะสม
ลายเซ็น:
export declare function register(type: string, fieldClass: RegistrableField): void;
พารามิเตอร์
พารามิเตอร์ |
ประเภท |
คำอธิบาย |
ประเภท |
สตริง |
ชื่อประเภทช่องตามที่ใช้ในคำจำกัดความ JSON |
fieldClass |
RegistrableField |
คลาสฟิลด์ที่มีฟังก์ชัน fromJson ที่สามารถสร้างอินสแตนซ์ของฟิลด์ |
การคืนสินค้า:
เป็นโมฆะ
ข้อยกเว้น
{ข้อผิดพลาด} หากชื่อประเภทว่างเปล่า แสดงว่ามีการลงทะเบียนช่องนี้แล้ว หรือ FieldClass ไม่ใช่ออบเจ็กต์ที่มีฟังก์ชัน fromJson
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[],["The `fieldRegistry.register()` function registers a field type for use with `fieldRegistry.fromJson`. It takes two parameters: `type` (a string representing the field type name) and `fieldClass` (a class with a `fromJson` function for constructing field instances). It returns void. The function throws an error if the type is empty, the field is already registered, or the class is invalid. It enables the system to find the appropriate field type during JSON parsing.\n"]]