mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Allow skeleton.setAttachment to accept null as attachmentName.
This commit is contained in:
parent
7f5502233f
commit
279e083baa
@ -407,7 +407,7 @@ export class Skeleton {
|
|||||||
/** A convenience method to set an attachment by finding the slot with {@link findSlot()}, finding the attachment with
|
/** A convenience method to set an attachment by finding the slot with {@link findSlot()}, finding the attachment with
|
||||||
* {@link getAttachment()}, then setting the slot's {@link Slot.attachment}.
|
* {@link getAttachment()}, then setting the slot's {@link Slot.attachment}.
|
||||||
* @param attachmentName May be null to clear the slot's attachment. */
|
* @param attachmentName May be null to clear the slot's attachment. */
|
||||||
setAttachment (slotName: string, attachmentName: string) {
|
setAttachment (slotName: string, attachmentName: string | null) {
|
||||||
if (!slotName) throw new Error("slotName cannot be null.");
|
if (!slotName) throw new Error("slotName cannot be null.");
|
||||||
const slot = this.findSlot(slotName);
|
const slot = this.findSlot(slotName);
|
||||||
if (!slot) throw new Error(`Slot not found: ${slotName}`);
|
if (!slot) throw new Error(`Slot not found: ${slotName}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user