You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
2.9 KiB
JavaScript

1 year ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[4012],{5592:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>i});var t=n(5893),a=n(1151);const r={id:"messagecenter",title:"9. MessageCenter \u9759\u6001\u7c7b",sidebar_label:"9. MessageCenter \u9759\u6001\u7c7b"},o=void 0,l={id:"global/messagecenter",title:"9. MessageCenter \u9759\u6001\u7c7b",description:"9.1 \u52a8\u6001\u8ba2\u9605\u6d88\u606f",source:"@site/docs/global/messagecenter.mdx",sourceDirName:"global",slug:"/global/messagecenter",permalink:"/docs/global/messagecenter",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/global/messagecenter.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1661825584,formattedLastUpdatedAt:"Aug 30, 2022",frontMatter:{id:"messagecenter",title:"9. MessageCenter \u9759\u6001\u7c7b",sidebar_label:"9. MessageCenter \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"8. L \u9759\u6001\u7c7b",permalink:"/docs/global/l"},next:{title:"10. JSON \u9759\u6001\u7c7b",permalink:"/docs/global/json"}},c={},i=[{value:"9.1 \u52a8\u6001\u8ba2\u9605\u6d88\u606f",id:"91-\u52a8\u6001\u8ba2\u9605\u6d88\u606f",level:2},{value:"9.2 \u53d1\u9001\u6d88\u606f",id:"92-\u53d1\u9001\u6d88\u606f",level:2},{value:"9.3 \u53d6\u6d88\u8ba2\u9605",id:"93-\u53d6\u6d88\u8ba2\u9605",level:2}];function d(e){const s={code:"code",h2:"h2",pre:"pre",...(0,a.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.h2,{id:"91-\u52a8\u6001\u8ba2\u9605\u6d88\u606f",children:"9.1 \u52a8\u6001\u8ba2\u9605\u6d88\u606f"}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-cs",metastring:"showLineNumbers ",children:'MessageCenter.Subscribe("messageId", async (ctx) => {\r\n Console.WriteLine("\u6211\u662f\u52a8\u6001\u7684");\r\n await Task.CompletedTask;\r\n});\n'})}),"\n",(0,t.jsx)(s.h2,{id:"92-\u53d1\u9001\u6d88\u606f",children:"9.2 \u53d1\u9001\u6d88\u606f"}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-cs",metastring:"showLineNumbers ",children:'await MessageCenter.PublishAsync("messageId", new {});\r\n\r\n// \u8bf8\u591a\u91cd\u8f7d\n'})}),"\n",(0,t.jsx)(s.h2,{id:"93-\u53d6\u6d88\u8ba2\u9605",children:"9.3 \u53d6\u6d88\u8ba2\u9605"}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-cs",metastring:"showLineNumbers ",children:'MessageCenter.Unsubscribe("messageId");\n'})})]})}function u(e={}){const{wrapper:s}={...(0,a.a)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},1151:(e,s,n)=>{n.d(s,{Z:()=>l,a:()=>o});var t=n(7294);const a={},r=t.createContext(a);function o(e){const s=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),t.createElement(r.Provider,{value:s},e.children)}}}]);