Skip to content

Commit

Permalink
docs: Fix missing js client functions (#3250)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusLasserre authored Jan 18, 2024
1 parent 28459c5 commit 1e1764f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/docs/clients/client-side/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,14 @@ All function and property types can be seen
| <code>getTrait(key:string)=> string&#124;number&#124;boolean</code> | Once used with an identified user you can get the value of any trait that is set for them e.g. `flagsmith.getTrait("accepted_cookie_policy")` |
| <code>getAllTraits()=> Record&lt;string,string&#124;number&#124;boolean&gt;</code> | Once used with an identified user you can get a key value pair of all traits that are set for them e.g. `flagsmith.getTraits()` |
| <code>getState()=>IState</code> | Retrieves the current state of flagsmith, useful in NextJS / isomorphic applications. `flagsmith.getState()` |
| <code>setState(state: IState)=>void</code> | Set the current state of flagsmith, [useful in NextJS / isomorphic applications.](/clients/next-ssr#comparing-ssr-and-client-side-flagsmith-usage) e.g. `flagsmith.setState({identity: '[email protected]'})`. |
| <code>setTrait(key:string, value:string&#124;number&#124;boolean)=> Promise&lt;IFlags&gt;</code> | Once used with an identified user you can set the value of any trait relevant to them e.g. `flagsmith.setTrait("accepted_cookie_policy", true)` |
| <code>setTraits(values:Record\<string, string&#124;number&#124;boolean>)=\> Promise&lt;IFlags&gt;</code> | Set multiple traits e.g. `flagsmith.setTraits({foo:"bar",numericProp:1,boolProp:true})`. Setting a value of null for a trait will remove that trait. |
| <code>incrementTrait(key:string, value:number)=> Promise&lt;IFlags&gt;</code> | You can also increment/decrement a particular trait them e.g. `flagsmith.incrementTrait("click_count", 1)` |
| <code>startListening(ticks=1000:number)=>void</code> | Poll the api for changes every x milliseconds |
| <code>stopListening()=>void</code> | Stop polling the api |
| <code>getFlags()=> Promise&lt;IFlags&gt;</code> | Trigger a manual fetch of the environment features, if a user is identified it will fetch their features. Resolves a promise when the flags are updated. |
| <code>getAllFlags()=> &lt;IFlags&gt;</code> | Returns the current flags. |
| <code>identify(userId:string, traits?:Record\<string, string or number or boolean\>)=> Promise&lt;IFlags&gt;</code> | Identify as a user, optionally with traits e.g. `{foo:"bar",numericProp:1,boolProp:true}`. This will create a user for your environment in the dashboard if they don't exist, it will also trigger a call to `getFlags()`, resolves a promise when the flags are updated. |
| <code>logout()=>Promise&lt;IFlags&gt;</code> | Stop identifying as a user, this will trigger a call to `getFlags()` |

Expand Down

3 comments on commit 1e1764f

@vercel
Copy link

@vercel vercel bot commented on 1e1764f Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs.bullet-train.io
docs-git-main-flagsmith.vercel.app
docs.flagsmith.com
docs-flagsmith.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 1e1764f Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 1e1764f Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.