Skip to content

Commit

Permalink
Update Migration Guide
Browse files Browse the repository at this point in the history
include new User methods:
- getOnesignalId
- getExternalId
- addEventListener/removeEventListener
  • Loading branch information
jennantilla committed Jan 9, 2024
1 parent 82d6702 commit 14b73ed
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,21 @@ The User name space is accessible via `OneSignal.User` and provides access to us
| `OneSignal.User.removeTag("KEY");` | *Remove the data tag with the provided key from the current user.* |
| `OneSignal.User.removeTags(["KEY_01", "KEY_02"]);` | *Remove multiple tags with the provided keys from the current user.* |
| `OneSignal.User.getTags();` | *Returns the local tags for the current user.* |
| `OneSignal.User.addEventListener("change", (event: UserChangedState) => void);` <br><br>***See below for usage*** | *Add a User State callback which contains the nullable onesignalId and externalId. The listener will be fired when these values change.* |
| `OneSignal.User.getOnesignalId();` | *Returns the nullable OneSignal ID for the current user.* |
| `OneSignal.User.getExternalId();` | *Returns the nullable external ID for the current user.* |

### User State Listener

**Cordova/Ionic**
```typescript
const listener = (event: UserChangedState) => {
console.log("User changed: " + (event));
};
OneSignal.User.addEventListener("change", listener);
// Remove the listener
OneSignal.User.removeEventListener("change", listener);
```

## Push Subscription Namespace

Expand Down

0 comments on commit 14b73ed

Please sign in to comment.