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
7.5 KiB
JavaScript

1 year ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[223],{3101:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>t,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var i=r(5893),s=r(1151);const a={id:"sparetime",title:"12. SpareTime \u9759\u6001\u7c7b",sidebar_label:"12. SpareTime \u9759\u6001\u7c7b"},o=void 0,c={id:"global/sparetime",title:"12. SpareTime \u9759\u6001\u7c7b",description:"\u4ee5\u4e0b\u5185\u5bb9\u5728 Furion 4.8.4 + \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002",source:"@site/docs/global/sparetime.mdx",sourceDirName:"global",slug:"/global/sparetime",permalink:"/docs/global/sparetime",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/global/sparetime.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1673022799,formattedLastUpdatedAt:"Jan 6, 2023",frontMatter:{id:"sparetime",title:"12. SpareTime \u9759\u6001\u7c7b",sidebar_label:"12. SpareTime \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"11. Scoped \u9759\u6001\u7c7b",permalink:"/docs/global/scoped"},next:{title:"13. FS \u9759\u6001\u7c7b",permalink:"/docs/global/fs"}},t={},l=[{value:"12.1 \u521d\u59cb\u5316\u4efb\u52a1",id:"121-\u521d\u59cb\u5316\u4efb\u52a1",level:2},{value:"12.2 \u5b9e\u73b0\u540e\u53f0\u6267\u884c",id:"122-\u5b9e\u73b0\u540e\u53f0\u6267\u884c",level:2},{value:"12.3 \u5f00\u59cb\u4e00\u4e2a\u4efb\u52a1",id:"123-\u5f00\u59cb\u4e00\u4e2a\u4efb\u52a1",level:2},{value:"12.4 \u6682\u505c\u4e00\u4e2a\u4efb\u52a1",id:"124-\u6682\u505c\u4e00\u4e2a\u4efb\u52a1",level:2},{value:"12.5 \u53d6\u6d88\u4e00\u4e2a\u4efb\u52a1",id:"125-\u53d6\u6d88\u4e00\u4e2a\u4efb\u52a1",level:2},{value:"12.6 \u9500\u6bc1\u6240\u6709\u4efb\u52a1",id:"126-\u9500\u6bc1\u6240\u6709\u4efb\u52a1",level:2},{value:"12.7 \u83b7\u53d6\u6240\u6709\u4efb\u52a1",id:"127-\u83b7\u53d6\u6240\u6709\u4efb\u52a1",level:2},{value:"12.8 \u83b7\u53d6\u5355\u4e2a\u4efb\u52a1",id:"128-\u83b7\u53d6\u5355\u4e2a\u4efb\u52a1",level:2},{value:"12.9 \u89e3\u6790 <code>Cron</code> \u8868\u8fbe\u5f0f",id:"129-\u89e3\u6790-cron-\u8868\u8fbe\u5f0f",level:2},{value:"12.10 <code>BackgroundService</code> \u95f4\u9694\u5b9a\u65f6\u4efb\u52a1",id:"1210-backgroundservice-\u95f4\u9694\u5b9a\u65f6\u4efb\u52a1",level:2},{value:"12.11 <code>BackgroundService</code> <code>Cron</code> \u5b9a\u65f6\u4efb\u52a1",id:"1211-backgroundservice-cron-\u5b9a\u65f6\u4efb\u52a1",level:2}];function d(e){const n={admonition:"admonition",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.admonition,{title:"\u91cd\u8981\u58f0\u660e",type:"warning",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u5728 ",(0,i.jsx)(n.code,{children:"Furion 4.8.4 +"})," \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"SpareTime"})," \u9759\u6001\u7c7b\u63d0\u4f9b\u4e86\u4e00\u4e9b\u65b9\u6cd5\u65b9\u4fbf\u521d\u59cb\u5316\u548c\u7ba1\u7406\u4efb\u52a1"]}),"\n",(0,i.jsx)(n.h2,{id:"121-\u521d\u59cb\u5316\u4efb\u52a1",children:"12.1 \u521d\u59cb\u5316\u4efb\u52a1"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"// \u5f00\u542f\u95f4\u9694\u4efb\u52a1\r\nSpareTime.Do(interval, [options]);\r\n\r\n// \u5f00\u542f Cron \u8868\u8fbe\u5f0f\u4efb\u52a1\r\nSpareTime.Do(expression, [options]);\r\n\r\n// \u53ea\u6267\u884c\u4e00\u6b21\u4efb\u52a1\r\nSpareTime.DoOnce(interval, [options]);\r\n\r\n// \u5b9e\u73b0\u81ea\u5b9a\u4e49\u4efb\u52a1\r\nSpareTime.Do(()=>{\r\n return DateTime.Now.AddMinutes(10);\r\n},[options]);\n"})}),"\n",(0,i.jsx)(n.h2,{id:"122-\u5b9e\u73b0\u540e\u53f0\u6267\u884c",children:"12.2 \u5b9e\u73b0\u540e\u53f0\u6267\u884c"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"// \u5b9e\u73b0\u540e\u53f0\u6267\u884c\r\nSpareTime.DoIt(()=>{});\n"})}),"\n",(0,i.jsx)(n.h2,{id:"123-\u5f00\u59cb\u4e00\u4e2a\u4efb\u52a1",children:"12.3 \u5f00\u59cb\u4e00\u4e2a\u4efb\u52a1"}),"\n",(0,i.j