[{"data":1,"prerenderedAt":95},["ShallowReactive",2],{"docs:\u002Fdocs\u002Fjavascript":3,"docs-navigation":55},{"id":4,"title":5,"body":6,"description":16,"extension":48,"meta":49,"navigation":50,"path":51,"seo":52,"stem":53,"__hash__":54},"docs\u002Fdocs\u002Fjavascript.md","JavaScript quickstart",{"type":7,"value":8,"toc":45},"minimark",[9,13,17,28,36],[10,11,5],"h1",{"id":12},"javascript-quickstart",[14,15,16],"p",{},"Use the browser SDK when a web app reads flags for one user at a time. Get your public client key from SDK keys in the panel. Start with the environment where you can test a release.",[18,19,25],"pre",{"className":20,"code":22,"language":23,"meta":24},[21],"language-sh","npm install @dipswitch\u002Fsdk-js\n","sh","",[26,27,22],"code",{"__ignoreMap":24},[18,29,34],{"className":30,"code":32,"language":33,"meta":24},[31],"language-ts","import { createClient } from '@dipswitch\u002Fsdk-js'\n\nconst flags = createClient({ clientKey: 'ds_client_...', user: { id: 'user-42' } })\nawait flags.ready\n\nfunction render() {\n  document.body.classList.toggle('new-checkout', flags.isEnabled('new-checkout', false))\n}\n\nrender()\nconst stop = flags.onChange(render)\nexport const switchUser = (id: string) => flags.identify({ id })\nexport const signOut = () => flags.identify(undefined)\nexport const dispose = () => { stop(); flags.close() }\n","ts",[26,35,32],{"__ignoreMap":24},[14,37,38,39,44],{},"Pass no user for signed-out pages. During a user switch, the SDK reads the new user's cached flags if available and otherwise uses your defaults. See ",[40,41,43],"a",{"href":42},"\u002Fdocs\u002Fidentity\u002F","Verify user identity"," if the environment requires a signature.",{"title":24,"searchDepth":46,"depth":46,"links":47},2,[],"md",{},true,"\u002Fdocs\u002Fjavascript",{"title":5,"description":16},"docs\u002Fjavascript","r3lQtF1OyxW88HWDmqpHJd9XyJcLLaJImSuWWYyeS8Y",[56,59,62,64,67,68,71,74,77,80,83,86,89,92],{"path":57,"title":58},"\u002Fdocs","Dipswitch documentation",{"path":60,"title":61},"\u002Fdocs\u002Fdotnet",".NET quickstart",{"path":63,"title":43},"\u002Fdocs\u002Fidentity",{"path":65,"title":66},"\u002Fdocs\u002Fjava","Java quickstart",{"path":51,"title":5},{"path":69,"title":70},"\u002Fdocs\u002Flaunchdarkly","Migrate from LaunchDarkly",{"path":72,"title":73},"\u002Fdocs\u002Fmanagement-api","Management API",{"path":75,"title":76},"\u002Fdocs\u002Fnode","Node.js quickstart",{"path":78,"title":79},"\u002Fdocs\u002Fopenfeature","OpenFeature and OFREP",{"path":81,"title":82},"\u002Fdocs\u002Fphp","PHP quickstart",{"path":84,"title":85},"\u002Fdocs\u002Fplans","Plans and limits",{"path":87,"title":88},"\u002Fdocs\u002Frate-limits","Rate limits",{"path":90,"title":91},"\u002Fdocs\u002Freact","React quickstart",{"path":93,"title":94},"\u002Fdocs\u002Fvue","Vue quickstart",1795767833782]