[{"data":1,"prerenderedAt":464},["ShallowReactive",2],{"navigation_docs":3,"-proxy-service-service-keys":127,"-proxy-service-service-keys-surround":461},[4,22,51,62,73,84,99,115],{"title":5,"path":6,"stem":7,"children":8,"page":21},"Get Started","/get-started","0.get-started",[9,13,17],{"title":10,"path":11,"stem":12},"Introduction","/get-started/introduction","0.get-started/0.introduction",{"title":14,"path":15,"stem":16},"Browser Support","/get-started/browser-support","0.get-started/1.browser-support",{"title":18,"path":19,"stem":20},"Contributing","/get-started/contributing","0.get-started/2.contributing",false,{"title":23,"path":24,"stem":25,"children":26,"page":21},"Fake Browser","/fake-browser","fake-browser",[27,31,35,39,43,47],{"title":28,"path":29,"stem":30},"Installation","/fake-browser/installation","fake-browser/0.installation",{"title":32,"path":33,"stem":34},"Testing Frameworks","/fake-browser/testing-frameworks","fake-browser/1.testing-frameworks",{"title":36,"path":37,"stem":38},"Triggering Events","/fake-browser/triggering-events","fake-browser/2.triggering-events",{"title":40,"path":41,"stem":42},"Resetting State","/fake-browser/reseting-state","fake-browser/3.reseting-state",{"title":44,"path":45,"stem":46},"Implemented Apis","/fake-browser/implemented-apis","fake-browser/4.implemented-apis",{"title":48,"path":49,"stem":50},"API Reference","/fake-browser/api","fake-browser/api",{"title":52,"path":53,"stem":54,"children":55,"page":21},"Isolated Element","/isolated-element","isolated-element",[56,59],{"title":28,"path":57,"stem":58},"/isolated-element/installation","isolated-element/0.installation",{"title":48,"path":60,"stem":61},"/isolated-element/api","isolated-element/api",{"title":63,"path":64,"stem":65,"children":66,"page":21},"Job Scheduler","/job-scheduler","job-scheduler",[67,70],{"title":28,"path":68,"stem":69},"/job-scheduler/installation","job-scheduler/0.installation",{"title":48,"path":71,"stem":72},"/job-scheduler/api","job-scheduler/api",{"title":74,"path":75,"stem":76,"children":77,"page":21},"Match Patterns","/match-patterns","match-patterns",[78,81],{"title":28,"path":79,"stem":80},"/match-patterns/installation","match-patterns/0.installation",{"title":48,"path":82,"stem":83},"/match-patterns/api","match-patterns/api",{"title":85,"path":86,"stem":87,"children":88,"page":21},"Messaging","/messaging","messaging",[89,92,96],{"title":28,"path":90,"stem":91},"/messaging/installation","messaging/0.installation",{"title":93,"path":94,"stem":95},"Protocol Maps","/messaging/protocol-maps","messaging/1.protocol-maps",{"title":48,"path":97,"stem":98},"/messaging/api","messaging/api",{"title":100,"path":101,"stem":102,"children":103,"page":21},"Proxy Service","/proxy-service","proxy-service",[104,107,111],{"title":28,"path":105,"stem":106},"/proxy-service/installation","proxy-service/0.installation",{"title":108,"path":109,"stem":110},"Defining Services","/proxy-service/defining-services","proxy-service/1.defining-services",{"title":112,"path":113,"stem":114},"Service Keys","/proxy-service/service-keys","proxy-service/2.service-keys",{"title":116,"path":117,"stem":118,"children":119,"page":21},"Storage","/storage","storage",[120,123],{"title":28,"path":121,"stem":122},"/storage/installation","storage/0.installation",{"title":124,"path":125,"stem":126},"Typescript","/storage/typescript","storage/1.typescript",{"id":128,"title":112,"body":129,"description":158,"extension":456,"links":457,"meta":458,"navigation":291,"path":113,"seo":459,"stem":114,"__hash__":460},"docs/proxy-service/2.service-keys.md",{"type":130,"value":131,"toc":454},"minimark",[132,136,351,357,360,450],[133,134,135],"p",{},"There are two ways of defining service keys:",[137,138,139,243],"ol",{},[140,141,142,146,147,151,152],"li",{},[143,144,145],"strong",{},"Using a string literal",": This is simple, but it provides no type-safety guaranteeing that the registered service is the same type as the proxy. Notice how you have to provide a type argument to the ",[148,149,150],"code",{},"createProxyService"," function.",[153,154,159],"pre",{"className":155,"code":156,"language":157,"meta":158,"style":158},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const key = 'math-service';\nregisterService(key, new MathService());\nconst proxy = createProxyService\u003CMathService>(key);\n","ts","",[148,160,161,191,215],{"__ignoreMap":158},[162,163,166,170,174,178,181,185,188],"span",{"class":164,"line":165},"line",1,[162,167,169],{"class":168},"spNyl","const",[162,171,173],{"class":172},"sTEyZ"," key ",[162,175,177],{"class":176},"sMK4o","=",[162,179,180],{"class":176}," '",[162,182,184],{"class":183},"sfazB","math-service",[162,186,187],{"class":176},"'",[162,189,190],{"class":176},";\n",[162,192,194,198,201,204,207,210,213],{"class":164,"line":193},2,[162,195,197],{"class":196},"s2Zo4","registerService",[162,199,200],{"class":172},"(key",[162,202,203],{"class":176},",",[162,205,206],{"class":176}," new",[162,208,209],{"class":196}," MathService",[162,211,212],{"class":172},"())",[162,214,190],{"class":176},[162,216,218,220,223,225,228,231,235,238,241],{"class":164,"line":217},3,[162,219,169],{"class":168},[162,221,222],{"class":172}," proxy ",[162,224,177],{"class":176},[162,226,227],{"class":196}," createProxyService",[162,229,230],{"class":176},"\u003C",[162,232,234],{"class":233},"sBMFI","MathService",[162,236,237],{"class":176},">",[162,239,240],{"class":172},"(key)",[162,242,190],{"class":176},[140,244,245,251,252],{},[143,246,247,248],{},"Cast to ",[148,249,250],{},"ProxyServiceKey",": The key is cast to a \"branded type\" that contains the service type. This guarantees you both register the expected service and create a proxy with the correct type with minimal code.",[153,253,255],{"className":155,"code":254,"language":157,"meta":158,"style":158},"import type { ProxyServiceKey } from '@webext-core/proxy-service';\n\nconst key = 'math-service' as ProxyServiceKey\u003CMathService>;\nregisterService(key, new MathService());\nconst proxy = createProxyService(key);\n",[148,256,257,287,293,319,336],{"__ignoreMap":158},[162,258,259,263,266,269,272,275,278,280,283,285],{"class":164,"line":165},[162,260,262],{"class":261},"s7zQu","import",[162,264,265],{"class":261}," type",[162,267,268],{"class":176}," {",[162,270,271],{"class":172}," ProxyServiceKey",[162,273,274],{"class":176}," }",[162,276,277],{"class":261}," from",[162,279,180],{"class":176},[162,281,282],{"class":183},"@webext-core/proxy-service",[162,284,187],{"class":176},[162,286,190],{"class":176},[162,288,289],{"class":164,"line":193},[162,290,292],{"emptyLinePlaceholder":291},true,"\n",[162,294,295,297,299,301,303,305,307,310,312,314,316],{"class":164,"line":217},[162,296,169],{"class":168},[162,298,173],{"class":172},[162,300,177],{"class":176},[162,302,180],{"class":176},[162,304,184],{"class":183},[162,306,187],{"class":176},[162,308,309],{"class":261}," as",[162,311,271],{"class":233},[162,313,230],{"class":176},[162,315,234],{"class":233},[162,317,318],{"class":176},">;\n",[162,320,322,324,326,328,330,332,334],{"class":164,"line":321},4,[162,323,197],{"class":196},[162,325,200],{"class":172},[162,327,203],{"class":176},[162,329,206],{"class":176},[162,331,209],{"class":196},[162,333,212],{"class":172},[162,335,190],{"class":176},[162,337,339,341,343,345,347,349],{"class":164,"line":338},5,[162,340,169],{"class":168},[162,342,222],{"class":172},[162,344,177],{"class":176},[162,346,227],{"class":196},[162,348,240],{"class":172},[162,350,190],{"class":176},[133,352,353,354,356],{},"Using ",[148,355,250],{}," is highly recommended. It ensures type-safety everywhere, and it usually a good idea to create a shared constant for keys like this, so just add a simple cast!",[133,358,359],{},"Just make sure wherever your store the service keys, you DO NOT IMPORT THE REAL SERVICES, just their types:",[153,361,364],{"className":155,"code":362,"filename":363,"language":157,"meta":158,"style":158},"import type { ProxyServiceKey } from '@webext-core/proxy-service';\nimport type { MathService } from './math-service';\n//     ^^^^ DO NOT FORGET THE type KEYWORD\n\nexport const MATH_SERVICE_KEY = 'math-service' as ProxyServiceKey\u003CMathService>;\n","proxy-service-keys.ts",[148,365,366,388,411,417,421],{"__ignoreMap":158},[162,367,368,370,372,374,376,378,380,382,384,386],{"class":164,"line":165},[162,369,262],{"class":261},[162,371,265],{"class":261},[162,373,268],{"class":176},[162,375,271],{"class":172},[162,377,274],{"class":176},[162,379,277],{"class":261},[162,381,180],{"class":176},[162,383,282],{"class":183},[162,385,187],{"class":176},[162,387,190],{"class":176},[162,389,390,392,394,396,398,400,402,404,407,409],{"class":164,"line":193},[162,391,262],{"class":261},[162,393,265],{"class":261},[162,395,268],{"class":176},[162,397,209],{"class":172},[162,399,274],{"class":176},[162,401,277],{"class":261},[162,403,180],{"class":176},[162,405,406],{"class":183},"./math-service",[162,408,187],{"class":176},[162,410,190],{"class":176},[162,412,413],{"class":164,"line":217},[162,414,416],{"class":415},"sHwdD","//     ^^^^ DO NOT FORGET THE type KEYWORD\n",[162,418,419],{"class":164,"line":321},[162,420,292],{"emptyLinePlaceholder":291},[162,422,423,426,429,432,434,436,438,440,442,444,446,448],{"class":164,"line":338},[162,424,425],{"class":261},"export",[162,427,428],{"class":168}," const",[162,430,431],{"class":172}," MATH_SERVICE_KEY ",[162,433,177],{"class":176},[162,435,180],{"class":176},[162,437,184],{"class":183},[162,439,187],{"class":176},[162,441,309],{"class":261},[162,443,271],{"class":233},[162,445,230],{"class":176},[162,447,234],{"class":233},[162,449,318],{"class":176},[451,452,453],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}",{"title":158,"searchDepth":193,"depth":193,"links":455},[],"md",null,{},{"title":112,"description":158},"SkIbN3I65YnCkAi2SkyGULTDusTtNHNNjFoeqfyFbks",[462,463],{"title":108,"path":109,"stem":110,"description":158,"children":-1},{"title":28,"path":121,"stem":122,"description":158,"children":-1},1780345474648]