Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update links, add info about key for anymous users #190

Merged
merged 1 commit into from
Sep 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ Before being used, Launch Darkly must be initialized. This should happen early s

The `initialize()` function returns a promise that resolves when the Launch Darkly client is ready so Ember will wait until this happens before proceeding.

The user `key` is the only required attribute, see the [Launch Darkly documentation](https://docs.launchdarkly.com/docs/js-sdk-reference#section-users) for the other attributes you can provide.
The user `key` is the only required attribute.

The `initialize()` function accepts a second parameter, an object, which is **optional**. It allows to you configure the Launch Darkly client, see the [Launch Darkly documentation](https://docs.launchdarkly.com/sdk/client-side/javascript#customizing-your-client) to learn more about available options and default values.
See the [Launch Darkly User documentation](https://docs.launchdarkly.com/sdk/client-side/javascript#users) for the other attributes you can provide.

```js
// /app/application/route.js
Expand All @@ -121,16 +121,30 @@ import Route from '@ember/routing/route';
export default Route.extend({
model() {
let user = {
key: 'aa0ceb',
anonymous: true
key: 'aa0ceb'
};

let options = {
sendEvents: false, // default is true, see https://docs.launchdarkly.com/sdk/client-side/javascript#analytics-events
hash: "SERVER_GENERATED_HASH", // see https://docs.launchdarkly.com/sdk/client-side/javascript#secure-mode
return this.launchDarkly.initialize(user);
}
});
```

If you set the `anonymous` flag to true, then the key is not required.

See the [Launch Darkly Anonymous User documentation](https://docs.launchdarkly.com/sdk/client-side/javascript#users) for more on the `anonymous` flag.

```js
// /app/application/route.js

import Route from '@ember/routing/route';

export default Route.extend({
model() {
let user = {
anonymous: true
};

return this.launchDarkly.initialize(user, options);
return this.launchDarkly.initialize(user);
}
});
```
Expand Down