# Upgrade guide for Scheduler v5.4.0

## EventCopyPaste has been made asynchronous

The `EventCopyPaste` feature's `copyEvents` and `pasteEvents` has been made asynchronous. This makes the `beforeCopy` 
and `beforePaste` events asynchronously preventable and allows for native Clipboard API support.

If your code relies on a copy or paste action to complete, you will need to wait for the promise to be resolved.

**Old code:**

```javascript
function copyPaste()
{
    scheduler.copyEvents();
    doSomethingElse();
    scheduler.pasteEvents();
    finishDoingSomethingElse();
}
```

**New code:**

```javascript
async function copyPaste()
{
    await scheduler.copyEvents();
    doSomethingElse();
    await scheduler.pasteEvents();
    finishDoingSomethingElse();
}
```

...or...

```javascript
function copyPaste()
{
    return scheduler.copyEvents().then(() => {
        doSomethingElse();
        scheduler.pasteEvents().then(() => {
            finishDoingSomethingElse();
            return true;
        });
    });
}
```


<p class="last-modified">Last modified on 2023-10-26 8:19:20</p>