[{"data":1,"prerenderedAt":220},["ShallowReactive",2],{"docs:\u002Fen\u002Fdocs\u002Fguides\u002Flifecycle":3},{"id":4,"title":5,"body":6,"description":210,"extension":211,"meta":212,"navigation":215,"path":216,"seo":217,"stem":218,"__hash__":219},"docs_en\u002Fen\u002Fdocs\u002Fguides\u002Flifecycle.md","Instance lifecycle",{"type":7,"value":8,"toc":204},"minimark",[9,14,18,22,25,29,32,36,50,141,200],[10,11,13],"h2",{"id":12},"one-instance-per-target","One instance per target",[15,16,17],"p",{},"Mount after your target exists in the browser. Keep the instance while the application owns that element. Calling the constructor on the server or repeatedly mounting without destruction is incorrect. The core does not require a framework.",[10,19,21],{"id":20},"readiness","Readiness",[15,23,24],{},"whenReady covers initial asynchronous Markdown\u002FCSS. whenSourceReady covers loading and mounting the HTML\u002FCSS source interface. Await setContent\u002FsetCSS\u002FreplaceRange where their operation is asynchronous; do not infer readiness from one event-loop tick.",[10,26,28],{"id":27},"cleanup","Cleanup",[15,30,31],{},"Destroy is idempotent and releases editor resources, plugin commands, UI and managed listeners. Plugin cleanup errors may yield AggregateError after resources have been released. Your application must abort its own requests and release its external subscriptions.",[10,33,35],{"id":34},"async-mounts","Async mounts",[15,37,38,39,44,45,49],{},"A dynamic import can resolve after component unmounting. Track disposal before constructing and destroy a newly created instance if ownership has ended. Site demos follow this pattern. ",[40,41,43],"a",{"href":42},"\u002Fen\u002Fdocs\u002Fintegrations\u002Fvue-nuxt","Vue\u002FNuxt",", ",[40,46,48],{"href":47},"\u002Fen\u002Fdocs\u002Freference\u002Fmethods","methods",".",[51,52,57],"pre",{"className":53,"code":54,"language":55,"meta":56,"style":56},"language-ts shiki shiki-themes github-dark","const editor = new ViText(host, {\n  content: '# Начало', contentType: 'markdown', language: 'en'\n});\nawait editor.whenReady();\neditor.focus();\n","ts","",[58,59,60,87,109,115,130],"code",{"__ignoreMap":56},[61,62,65,69,73,76,79,83],"span",{"class":63,"line":64},"line",1,[61,66,68],{"class":67},"snl16","const",[61,70,72],{"class":71},"sDLfK"," editor",[61,74,75],{"class":67}," =",[61,77,78],{"class":67}," new",[61,80,82],{"class":81},"svObZ"," ViText",[61,84,86],{"class":85},"s95oV","(host, {\n",[61,88,90,93,97,100,103,106],{"class":63,"line":89},2,[61,91,92],{"class":85},"  content: ",[61,94,96],{"class":95},"sU2Wk","'# Начало'",[61,98,99],{"class":85},", contentType: ",[61,101,102],{"class":95},"'markdown'",[61,104,105],{"class":85},", language: ",[61,107,108],{"class":95},"'en'\n",[61,110,112],{"class":63,"line":111},3,[61,113,114],{"class":85},"});\n",[61,116,118,121,124,127],{"class":63,"line":117},4,[61,119,120],{"class":67},"await",[61,122,123],{"class":85}," editor.",[61,125,126],{"class":81},"whenReady",[61,128,129],{"class":85},"();\n",[61,131,133,136,139],{"class":63,"line":132},5,[61,134,135],{"class":85},"editor.",[61,137,138],{"class":81},"focus",[61,140,129],{"class":85},[51,142,144],{"className":53,"code":143,"language":55,"meta":56,"style":56},"const off = editor.on('change', event => console.log(event.revision));\noff();\neditor.destroy();\n",[58,145,146,184,191],{"__ignoreMap":56},[61,147,148,150,153,155,157,160,163,166,168,172,175,178,181],{"class":63,"line":64},[61,149,68],{"class":67},[61,151,152],{"class":71}," off",[61,154,75],{"class":67},[61,156,123],{"class":85},[61,158,159],{"class":81},"on",[61,161,162],{"class":85},"(",[61,164,165],{"class":95},"'change'",[61,167,44],{"class":85},[61,169,171],{"class":170},"s9osk","event",[61,173,174],{"class":67}," =>",[61,176,177],{"class":85}," console.",[61,179,180],{"class":81},"log",[61,182,183],{"class":85},"(event.revision));\n",[61,185,186,189],{"class":63,"line":89},[61,187,188],{"class":81},"off",[61,190,129],{"class":85},[61,192,193,195,198],{"class":63,"line":111},[61,194,135],{"class":85},[61,196,197],{"class":81},"destroy",[61,199,129],{"class":85},[201,202,203],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}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 pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":56,"searchDepth":89,"depth":89,"links":205},[206,207,208,209],{"id":12,"depth":89,"text":13},{"id":20,"depth":89,"text":21},{"id":27,"depth":89,"text":28},{"id":34,"depth":89,"text":35},"Mounting, lazy readiness, subscriptions and destroy.","md",{"group":213,"order":214},"Document guides",23,true,"\u002Fen\u002Fdocs\u002Fguides\u002Flifecycle",{"title":5,"description":210},"en\u002Fdocs\u002Fguides\u002Flifecycle","pDUQkVNL5nKVkhT4MnI9EQ9bugTNcejxKWXtZjQVyho",1792670389513]