text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[26],{c444:function(t,n,e){"use strict";e.r(n);var s=function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("doc-page",{attrs:{title:"App Extension Uninstall API",nav:t.nav}},[e("p",[t._v("This page refers to "),e("code",{staticClass:"doc-token"},[t._v("src/uninstall.js")]),t._v(" file which is executed when the App Extension is uninstalled. Not all App Extensions will need an uninstall – this is an optional step.")]),e("p",[t._v("Example of basic structure of the file:")]),e("pre",{pre:!0,attrs:{class:"doc-code language-js"}},[e("code",{pre:!0,attrs:{class:"doc-code__inner doc-code__inner--prerendered language-js"}},[t._v("module"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("exports")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("api")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n  "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v('// props and methods for "api" Object')]),t._v("\n  "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// are described below")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.extId"},on:{click:function(n){return t.copyHeading("api.extId")}}},[t._v("api.extId")]),e("p",[t._v("Contains the "),e("code",{staticClass:"doc-token"},[t._v("ext-id")]),t._v(" (String) of this App Extension.")]),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.prompts"},on:{click:function(n){return t.copyHeading("api.prompts")}}},[t._v("api.prompts")]),e("p",[t._v("Is an Object which has the answers to the prompts when this App Extension gets installed. For more info on prompts, check out "),e("doc-link",{attrs:{to:"/app-extensions/development-guide/prompts-api"}},[t._v("Prompts API")]),t._v(".")],1),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.resolve"},on:{click:function(n){return t.copyHeading("api.resolve")}}},[t._v("api.resolve")]),e("p",[t._v("Resolves paths within the app on which this App Extension is running. Eliminates the need to import "),e("code",{staticClass:"doc-token"},[t._v("path")]),t._v(" and resolve the paths yourself.")]),e("pre",{pre:!0,attrs:{class:"doc-code language-js"}},[e("code",{pre:!0,attrs:{class:"doc-code__inner doc-code__inner--prerendered language-js"}},[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolves to root of app")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("resolve"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("app")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'src/my-file.js'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolves to root/src of app")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("resolve"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("src")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'my-file.js'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolves to root/src-pwa of app")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("resolve"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("pwa")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'some-file.js'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolves to root/src-ssr of app")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("resolve"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("ssr")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'some-file.js'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolves to root/src-cordova of app")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("resolve"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("cordova")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'config.xml'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolves to root/src-electron of app")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("resolve"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("electron")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'some-file.js'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])]),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.appDir"},on:{click:function(n){return t.copyHeading("api.appDir")}}},[t._v("api.appDir")]),e("p",[t._v("Contains the full path (String) to the root of the app on which this App Extension is running.")]),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.hasExtension"},on:{click:function(n){return t.copyHeading("api.hasExtension")}}},[t._v("api.hasExtension")]),e("p",[t._v("Check if another app extension is installed.")]),e("pre",{pre:!0,attrs:{class:"doc-code language-js"}},[e("code",{pre:!0,attrs:{class:"doc-code__inner doc-code__inner--prerendered language-js"}},[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/**\n * Check if another app extension is installed\n *\n * @param {string} extId\n * @return {boolean} has the extension installed.\n */")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("api"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("hasExtension")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("extId"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n  "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// hey, we have it")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.removePath"},on:{click:function(n){return t.copyHeading("api.removePath")}}},[t._v("api.removePath")]),e("p",[t._v("Removes a file or folder from the app project folder (which the App Extension has installed and is no longer needed).")]),e("p",[t._v("Be mindful about it and do not delete the files that would break developer’s app.")]),e("p",[t._v("The path to file or folder needs to be relative to project’s root folder.")]),e("pre",{pre:!0,attrs:{class:"doc-code language-js"}},[e("code",{pre:!0,attrs:{class:"doc-code__inner doc-code__inner--prerendered language-js"}},[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/**\n  * @param {string} __path\n  */")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("removePath")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'my-folder'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])]),e("p",[t._v("The above example deletes “my-folder” from the root of the app.")]),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.getPersistentConf"},on:{click:function(n){return t.copyHeading("api.getPersistentConf")}}},[t._v("api.getPersistentConf")]),e("p",[t._v("Get the internal persistent config of this extension. Returns empty object if it has none.")]),e("pre",{pre:!0,attrs:{class:"doc-code language-js"}},[e("code",{pre:!0,attrs:{class:"doc-code__inner doc-code__inner--prerendered language-js"}},[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/**\n * @return {object} cfg\n */")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("getPersistentConf")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])]),e("h2",{staticClass:"doc-heading doc-h2",attrs:{id:"api.onExitLog"},on:{click:function(n){return t.copyHeading("api.onExitLog")}}},[t._v("api.onExitLog")]),e("p",[t._v("Adds a message to be printed after App CLI finishes up uninstalling the App Extension and is about to exit. Can be called multiple times to register multiple exit logs.")]),e("pre",{pre:!0,attrs:{class:"doc-code language-js"}},[e("code",{pre:!0,attrs:{class:"doc-code__inner doc-code__inner--prerendered language-js"}},[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/**\n * @param {string} msg\n */")]),t._v("\napi"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("onExitLog")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Thanks for having used my extension'")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])},a=[],o=e("8669"),p="App Extension Uninstall API | Quasar Framework",r="The API for the uninstall script of a Quasar App Extension.",i={meta:{title:"App Extension Uninstall API",meta:{title:{name:"title",content:p},ogTitle:{name:"og:title",content:p},twitterTitle:{name:"twitter:title",content:p},description:{name:"description",content:r},ogDesc:{name:"og:description",content:r},twitterDesc:{name:"twitter:description",content:r}}},preFetch:function(t){var n=t.store;n.commit("updateToc",[{id:"api.extId",title:"api.extId"},{id:"api.prompts",title:"api.prompts"},{id:"api.resolve",title:"api.resolve"},{id:"api.appDir",title:"api.appDir"},{id:"api.hasExtension",title:"api.hasExtension"},{id:"api.removePath",title:"api.removePath"},{id:"api.getPersistentConf",title:"api.getPersistentConf"},{id:"api.onExitLog",title:"api.onExitLog"}])},created:function(){this.nav=[{name:"Index API",category:"Development Guide",path:"/app-extensions/development-guide/index-api",dir:"left"},{name:"Introduction",category:"Tips and Tricks",path:"/app-extensions/tips-and-tricks/introduction",dir:"right"}]},methods:{copyHeading:o["a"]}},c=i,l=e("2877"),v=Object(l["a"])(c,s,a,!1,null,null,null);n["default"]=v.exports}}]);