# Selection changed event

**URL:** <https://forums.creativeclouddeveloper.com/t/selection-changed-event/1026>\
**Category:** UXP Plugin API\
**Tags:** javascript\
**Created:** [July 11, 2019, 4:42pm UTC](https://forums.creativeclouddeveloper.com/t/selection-changed-event/1026 "2019-07-11T16:42:03Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Velara](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/velara/32/1278_2.png) [@Velara](https://forums.creativeclouddeveloper.com/u/Velara)\
**Post date:** [July 11, 2019, 8:54pm UTC](https://forums.creativeclouddeveloper.com/t/selection-changed-event/1026/6 "2019-07-11T20:54:07Z")

</div>

There are no document events. There is an `update()` method that’s called when selection changes in your plugin panel. This contains all updates to a document like move, resize and selection change.

> [@Determine type of update in the panel update method](http://forums.creativeclouddeveloper.com/t/determine-type-of-update-in-the-panel-update-method/1013):
>
> I’m running some possibly processor intensive events on update() and I want to run those events only if there is a change to the artboard. Right now, if I simply change the selection the update method is called. Use Case If the user moved an rectangle then I want to know that the document has changed. If the user simply selected a different rectangle then the document has not changed and I want to avoid running any specific operations. async update(type) { if (type=="selection") updateUI()…

> [@Are there events represent for document editing?](http://forums.creativeclouddeveloper.com/t/are-there-events-represent-for-document-editing/214/):
>
> I want some events triggered by XD when document changes. Like imageChanges, documentChanges, documentSaved, contentEditing, etc. I don’t find them in the Plugin documents…

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/selection-changed-event/1026)._
