Bản khảo sát nghiên cứu: Cho chúng tôi biết trải nghiệm của bạn khi sử dụng Blockly
Bắt đầu khảo sát
chặn > Sự kiện > VarRename
Lớp Event.VarĐổi tên
Thông báo cho người nghe rằng một mô hình biến đã được đổi tên.
Chữ ký:
export declare class VarRename extends VarBase
Mở rộng: VarBase
Hàm khởi tạo
Thuộc tính
Thuộc tính |
Đối tượng sửa đổi |
Loại |
Mô tả |
tên mới? |
|
string |
(Không bắt buộc) Tên mới của biến. |
oldName? |
|
string |
(Không bắt buộc) Tên trước đây của biến. |
loại |
|
string |
|
Phương thức
Phương thức |
Đối tượng sửa đổi |
Mô tả |
chạy(tiến) |
|
Chạy sự kiện đổi tên biến. |
toJson() |
|
Mã hoá sự kiện dưới dạng JSON. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-09-12 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-09-12 UTC."],[[["The `Blockly.Events.VarRename` class handles events related to renaming variable models within Blockly workspaces."],["It extends the `Blockly.Events.VarBase` class and includes properties for the old and new variable names."],["Developers can use the `run` method to execute a variable rename event and `toJson` for serialization."],["Instances of this class are created with a constructor accepting the variable and its new name."]]],["The `VarRename` class, extending `VarBase`, notifies listeners about variable model renames. It is constructed with an optional variable and new name. Key properties include `newName` and `oldName` (both optional strings) to track the variable's name change. The class also defines the `type` property. Core methods include `run(forward)` to execute the rename and `toJson()` to convert the event into JSON format.\n"]]