Commit 45085a80 authored by Martin Alvarez-Espinar's avatar Martin Alvarez-Espinar
Browse files

Distribution generated

parent a7fc07f5
Pipeline #18393 failed with stage
in 1 minute and 35 seconds
This image diff could not be displayed because it is too large. You can view the blob instead.
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{400:function(t,a,e){t.exports=e.p+"assets/img/a01.eedf7747.gif"},455:function(t,a,e){"use strict";e.r(a);var s=e(31),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"a"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#a"}},[t._v("#")]),t._v(" "),s("code",[t._v("a")])]),t._v(" "),s("p",[t._v("(Anchor). This element defines a hyperlink.")]),t._v(" "),s("img",{staticStyle:{height:"500px","border-radius":"6px",border:"1px #333333 solid"},attrs:{src:e(400),alt:"Links on a Quick App"}}),t._v(" "),s("p",[t._v("("),s("a",{attrs:{href:"#example"}},[t._v("Example code")]),t._v(")")]),t._v(" "),s("p"),s("div",{staticClass:"table-of-contents"},[s("ul",[s("li",[s("a",{attrs:{href:"#children-elements"}},[t._v("Children Elements")])]),s("li",[s("a",{attrs:{href:"#attributes"}},[t._v("Attributes")]),s("ul",[s("li",[s("a",{attrs:{href:"#href"}},[t._v("href")])]),s("li",[s("a",{attrs:{href:"#lines"}},[t._v("lines")])]),s("li",[s("a",{attrs:{href:"#color"}},[t._v("color")])]),s("li",[s("a",{attrs:{href:"#letter-spacing"}},[t._v("letter-spacing")])]),s("li",[s("a",{attrs:{href:"#font-size"}},[t._v("font-size")])]),s("li",[s("a",{attrs:{href:"#font-style"}},[t._v("font-style")])]),s("li",[s("a",{attrs:{href:"#font-weight"}},[t._v("font-weight")])]),s("li",[s("a",{attrs:{href:"#text-decoration"}},[t._v("text-decoration")])]),s("li",[s("a",{attrs:{href:"#text-indent"}},[t._v("text-indent")])]),s("li",[s("a",{attrs:{href:"#text-align"}},[t._v("text-align")])]),s("li",[s("a",{attrs:{href:"#line-height"}},[t._v("line-height")])]),s("li",[s("a",{attrs:{href:"#text-overflow"}},[t._v("text-overflow")])]),s("li",[s("a",{attrs:{href:"#font-family"}},[t._v("font-family")])])])]),s("li",[s("a",{attrs:{href:"#events"}},[t._v("Events")])]),s("li",[s("a",{attrs:{href:"#methods"}},[t._v("Methods")])]),s("li",[s("a",{attrs:{href:"#example"}},[t._v("Example")])])])]),s("p"),t._v(" "),s("h2",{attrs:{id:"children-elements"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#children-elements"}},[t._v("#")]),t._v(" Children Elements")]),t._v(" "),s("p",[t._v("This element supports "),s("a",{attrs:{href:"./span"}},[s("code",[t._v("span")])]),t._v(" elements as children.")]),t._v(" "),s("h2",{attrs:{id:"attributes"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#attributes"}},[t._v("#")]),t._v(" Attributes")]),t._v(" "),s("p",[t._v("In addition to the "),s("a",{attrs:{href:"./attributes"}},[t._v("common attributes")]),t._v(", this element may contain the following attribute.")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"#href"}},[s("code",[t._v("href")])])])]),t._v(" "),s("h3",{attrs:{id:"href"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#href"}},[t._v("#")]),t._v(" "),s("code",[t._v("href")])]),t._v(" "),s("p",[t._v("Destination of the link.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("string")])]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("value")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("p",[t._v("For details about the supported link formats, see the URI parameter in "),s("RouterLink",{attrs:{to:"/services/page-routing.html#push-object"}},[t._v("page routing")]),t._v(".")],1),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),s("p",[t._v("You can use "),s("code",[t._v("?param1=value1")]),t._v(" to add parameters and access them on page instances through "),s("code",[t._v("this.param1")]),t._v(".")])]),t._v(" "),s("p",[t._v("Examples:")]),t._v(" "),s("div",{staticClass:"language-html extra-class"},[s("pre",{pre:!0,attrs:{class:"language-html"}},[s("code",[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("a")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("href")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("About?param1=value1"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("a")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("href")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("/about?param1=value1"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("a")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("href")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("https://www.example.org/?param1=value1"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n")])])]),s("h1",{attrs:{id:"css-properties"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#css-properties"}},[t._v("#")]),t._v(" CSS Properties")]),t._v(" "),s("p",[t._v("In addition to the "),s("a",{attrs:{href:"./styles"}},[t._v("common styles")]),t._v(", this element supports the following styling properties:")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"#lines"}},[s("code",[t._v("lines")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#color"}},[s("code",[t._v("color")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#letter-spacing"}},[s("code",[t._v("letter-spacing")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#font-size"}},[s("code",[t._v("font-size")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#font-style"}},[s("code",[t._v("font-style")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#font-weight"}},[s("code",[t._v("font-weight")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#text-decoration"}},[s("code",[t._v("text-decoration")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#text-indent"}},[s("code",[t._v("text-indent")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#text-align"}},[s("code",[t._v("text-align")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#line-height"}},[s("code",[t._v("line-height")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#text-overflow"}},[s("code",[t._v("text-overflow")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#font-family"}},[s("code",[t._v("font-family")])])])]),t._v(" "),s("p",[t._v("This element supports the "),s("RouterLink",{attrs:{to:"/guide/styling.html#css-selectors"}},[s("code",[t._v(":active")]),t._v(" pseudo-class")]),t._v(".")],1),t._v(" "),s("h3",{attrs:{id:"lines"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#lines"}},[t._v("#")]),t._v(" "),s("code",[t._v("lines")])]),t._v(" "),s("p",[t._v("Number of text lines. The value "),s("code",[t._v("-1")]),t._v(" indicates unlimited lines.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("number")])]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("-1")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"color"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#color"}},[t._v("#")]),t._v(" "),s("code",[t._v("color")])]),t._v(" "),s("p",[t._v("Color of the font.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("<color>")])]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("rgba(0, 0, 0, 0.54)")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"letter-spacing"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#letter-spacing"}},[t._v("#")]),t._v(" "),s("code",[t._v("letter-spacing")])]),t._v(" "),s("p",[t._v("Space between characters.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("<length>")])]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("0px")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"font-size"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#font-size"}},[t._v("#")]),t._v(" "),s("code",[t._v("font-size")])]),t._v(" "),s("p",[t._v("Font size.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("<length>")])]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("30px")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"font-style"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#font-style"}},[t._v("#")]),t._v(" "),s("code",[t._v("font-style")])]),t._v(" "),s("p",[t._v("Font style selected from the "),s("a",{attrs:{href:"#font-family"}},[t._v("font family")]),t._v(".")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("string")]),t._v(" ("),s("code",[t._v("italic")]),t._v(" |\t"),s("code",[t._v("normal")]),t._v(")")]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("normal")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"font-weight"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#font-weight"}},[t._v("#")]),t._v(" "),s("code",[t._v("font-weight")])]),t._v(" "),s("p",[t._v("Weight of the font.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("string")]),t._v(" ("),s("code",[t._v("lighter")]),t._v(" | "),s("code",[t._v("100")]),t._v(" | "),s("code",[t._v("200")]),t._v(" | "),s("code",[t._v("300")]),t._v(" | "),s("code",[t._v("400")]),t._v(" | "),s("code",[t._v("500")]),t._v(" | "),s("code",[t._v("600")]),t._v(" | "),s("code",[t._v("700")]),t._v(" | "),s("code",[t._v("800")]),t._v(" | "),s("code",[t._v("900")]),t._v(" | "),s("code",[t._v("normal")]),t._v(" | "),s("code",[t._v("bold")]),t._v(" | "),s("code",[t._v("bolder")]),t._v(")")]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("normal")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"text-decoration"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#text-decoration"}},[t._v("#")]),t._v(" "),s("code",[t._v("text-decoration")])]),t._v(" "),s("p",[t._v("Decoration options to the text.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("string")]),t._v(" ("),s("code",[t._v("underline")]),t._v(" | "),s("code",[t._v("line-through")]),t._v(" | "),s("code",[t._v("none")]),t._v(")")]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("none")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("div",{staticClass:"custom-block warning"},[s("p",{staticClass:"custom-block-title"},[t._v("WARNING")]),t._v(" "),s("p",[t._v("If you apply the "),s("code",[t._v("text-decoration")]),t._v(", you must set the "),s("a",{attrs:{href:"#value"}},[s("code",[t._v("value")])]),t._v(" attribute.")])]),t._v(" "),s("h3",{attrs:{id:"text-indent"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#text-indent"}},[t._v("#")]),t._v(" "),s("code",[t._v("text-indent")])]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("<length-percentage>")])]),t._v(" "),s("li",[t._v("Default value: -")]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"text-align"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#text-align"}},[t._v("#")]),t._v(" "),s("code",[t._v("text-align")])]),t._v(" "),s("p",[t._v("Alignment direction of the text, relative to its parent element.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("string")]),t._v(" ("),s("code",[t._v("left")]),t._v(" | "),s("code",[t._v("center")]),t._v(" | "),s("code",[t._v("right")]),t._v(")")]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("left")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),s("p",[t._v("If you use different languages, using different directions, use this attribute together with "),s("RouterLink",{attrs:{to:"/components/attributes.html#dir"}},[s("code",[t._v("dir")])]),t._v(".")],1)]),t._v(" "),s("h3",{attrs:{id:"line-height"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#line-height"}},[t._v("#")]),t._v(" "),s("code",[t._v("line-height")])]),t._v(" "),s("p",[t._v("Line height of the text.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("<length>")])]),t._v(" "),s("li",[t._v("Default value: -")]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"text-overflow"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#text-overflow"}},[t._v("#")]),t._v(" "),s("code",[t._v("text-overflow")])]),t._v(" "),s("p",[t._v("Content shown if overflow is active. It takes effect when the number of lines is specified.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("string")]),t._v(" ("),s("code",[t._v("clip")]),t._v(" | "),s("code",[t._v("ellipsis")]),t._v(")")]),t._v(" "),s("li",[t._v("Default value: "),s("code",[t._v("clip")])]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("h3",{attrs:{id:"font-family"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#font-family"}},[t._v("#")]),t._v(" "),s("code",[t._v("font-family")])]),t._v(" "),s("p",[t._v("Font family of for the text.")]),t._v(" "),s("ul",[s("li",[t._v("Type: "),s("code",[t._v("string")])]),t._v(" "),s("li",[t._v("Default value: -")]),t._v(" "),s("li",[t._v("Mandatory: no")])]),t._v(" "),s("p",[t._v("To customize fonts, please refer "),s("RouterLink",{attrs:{to:"/components/styles.html#font-face"}},[t._v("font-face style")]),t._v(".")],1),t._v(" "),s("h2",{attrs:{id:"events"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#events"}},[t._v("#")]),t._v(" Events")]),t._v(" "),s("p",[t._v("This element supports the "),s("a",{attrs:{href:"./events"}},[t._v("common events")]),t._v(".")]),t._v(" "),s("div",{staticClass:"custom-block warning"},[s("p",{staticClass:"custom-block-title"},[t._v("WARNING")]),t._v(" "),s("p",[t._v("When the a element is a child to the "),s("a",{attrs:{href:"text"}},[s("code",[t._v("text")])]),t._v(" element, only the "),s("RouterLink",{attrs:{to:"/components/events.html#click"}},[s("code",[t._v("click")])]),t._v(" event is supported.")],1),t._v(" "),s("h2",{attrs:{id:"methods"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#methods"}},[t._v("#")]),t._v(" Methods")]),t._v(" "),s("p",[t._v("This element does not have additional methods.")]),t._v(" "),s("h2",{attrs:{id:"example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#example"}},[t._v("#")]),t._v(" Example")]),t._v(" "),s("div",{staticClass:"language-html extra-class"},[s("pre",{pre:!0,attrs:{class:"language-html"}},[s("code",[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("template")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("div")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("container row-center"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("div")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("row-center"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("a")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("href")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("https://quick-app-initiative.ow2.io/"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("btn-transparent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("QAI Home Page (web)"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("a")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("div")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("div")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("row-center mt-btn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("a")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("href")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("/Component/container/stack"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("btn-transparent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("stack (quick app) page"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("a")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("div")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("div")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("template")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n")])])])])])}),[],!1,null,null,null);a.default=n.exports}}]);
\ No newline at end of file
(window.webpackJsonp=window.webpackJsonp||[]).push([[100],{542:function(t,e,s){"use strict";s.r(e);var a=s(31),n=Object(a.a)({},(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"request"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#request"}},[t._v("#")]),t._v(" Request")]),t._v(" "),s("p",[s("strong",[t._v("Network requests.")])]),t._v(" "),s("h2",{attrs:{id:"manifest-declaration"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#manifest-declaration"}},[t._v("#")]),t._v(" Manifest Declaration")]),t._v(" "),s("p",[t._v("You need to declare the use of this API in the "),s("RouterLink",{attrs:{to:"/guide/manifest.html#features"}},[t._v("manifest's "),s("code",[t._v("features")])]),t._v(" member:")],1),t._v(" "),s("div",{staticClass:"language-json extra-class"},[s("pre",{pre:!0,attrs:{class:"language-json"}},[s("code",[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"system.requesttask"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("h2",{attrs:{id:"module-import"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#module-import"}},[t._v("#")]),t._v(" Module Import")]),t._v(" "),s("p",[t._v("Before using this service in a component, you need to "),s("RouterLink",{attrs:{to:"/guide/scripting.html#import-and-export-modules"}},[t._v("import the module")]),t._v(" in the script section of the "),s("a",{attrs:{href:"../guide/ux-documents"}},[t._v("UX document")]),t._v(".")],1),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" requesttask "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'@system.requesttask'")]),t._v(" \n")])])]),s("p",[t._v("Or")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" requesttask "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"@system.requesttask"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"methods"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#methods"}},[t._v("#")]),t._v(" Methods")]),t._v(" "),s("p",[t._v("This service has the following methods:")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"#request-url-data-header-method-responsetype-timeout-success-fail-complete"}},[s("code",[t._v("request({url,data,header,method,responseType,timeout,success,fail,complete})")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#abort"}},[s("code",[t._v("abort()")])])])]),t._v(" "),s("h3",{attrs:{id:"request-url-data-header-method-responsetype-timeout-success-fail-complete"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#request-url-data-header-method-responsetype-timeout-success-fail-complete"}},[t._v("#")]),t._v(" "),s("code",[t._v("request({url,data,header,method,responseType,timeout,success,fail,complete})")])]),t._v(" "),s("p",[s("strong",[t._v("Method that creates a network request")]),t._v(".")]),t._v(" "),s("p",[t._v("Every time this method is called, a new "),s("code",[t._v("object")]),t._v(" is returned.")]),t._v(" "),s("h4",{attrs:{id:"arguments"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#arguments"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),s("p",[t._v("This method requires an "),s("code",[t._v("object")]),t._v(" with the following attributes:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("url")]),t._v(" ("),s("code",[t._v("string")]),t._v("). Mandatory attribute with the URL of the requested resource.")]),t._v(" "),s("li",[s("code",[t._v("data")]),t._v(" ("),s("code",[t._v("string")]),t._v("|"),s("code",[t._v("object")]),t._v("|"),s("code",[t._v("ArrayBuffer")]),t._v("). Optional parameter with the data sent in the call.")]),t._v(" "),s("li",[s("code",[t._v("header")]),t._v(" ("),s("code",[t._v("object")]),t._v('). Optional parameter with the HTTP header of the request, which includes all the information of the request. Example: `{"Accept-Encoding": "gzip, deflate","Accept-Language": "en-US,fr-FR;q=0.8,en;q=0.6",')]),t._v(" "),s("li",[s("code",[t._v("method")]),t._v(" ("),s("code",[t._v("string")]),t._v("). Optional attribute with the HTTP method: "),s("code",[t._v("OPTIONS")]),t._v(", "),s("code",[t._v("GET")]),t._v(" (default value), "),s("code",[t._v("HEAD")]),t._v(", "),s("code",[t._v("POST")]),t._v(", "),s("code",[t._v("PUT")]),t._v(", "),s("code",[t._v("DELETE")]),t._v(", "),s("code",[t._v("TRACE")]),t._v(", and "),s("code",[t._v("CONNECT")]),t._v(".")]),t._v(" "),s("li",[s("code",[t._v("responseType")]),t._v(" ("),s("code",[t._v("string")]),t._v("). Optional attribute with the type of the response: "),s("code",[t._v("text")]),t._v(", "),s("code",[t._v("json")]),t._v(", "),s("code",[t._v("file")]),t._v(", and "),s("code",[t._v("ArrayBuffer")]),t._v(". By default, the response type is determined based on the "),s("code",[t._v("Content-Type")]),t._v(" in the header returned by the server.")]),t._v(" "),s("li",[s("code",[t._v("timeout")]),t._v(" ("),s("code",[t._v("number")]),t._v("). Optional attribute that specifies the connection timeout (not the read/write timeout interval) in millisecond (by default "),s("code",[t._v("10000")]),t._v(").")]),t._v(" "),s("li",[s("code",[t._v("success")]),t._v("\t("),s("code",[t._v("function(res)")]),t._v("). Optional callback function corresponding to the successful execution. The argument of the callback function is an "),s("code",[t._v("object")]),t._v(" with the following members:\n"),s("ul",[s("li",[s("code",[t._v("statusCode")]),t._v(" ("),s("code",[t._v("number")]),t._v("). Server status code.")]),t._v(" "),s("li",[s("code",[t._v("statusText")]),t._v(" ("),s("code",[t._v("string")]),t._v("). Server status information.")]),t._v(" "),s("li",[s("code",[t._v("data")]),t._v(" ("),s("code",[t._v("string")]),t._v("|"),s("code",[t._v("object")]),t._v("|"),s("code",[t._v("ArrayBuffer")]),t._v("|"),s("code",[t._v("json")]),t._v("). Response data.")]),t._v(" "),s("li",[s("code",[t._v("header")]),t._v(" ("),s("code",[t._v("object")]),t._v("). HTTP headers in the response from the server.")])])]),t._v(" "),s("li",[s("code",[t._v("fail")]),t._v(" ("),s("code",[t._v("function")]),t._v("). Optional callback function corresponding to the failed execution.")]),t._v(" "),s("li",[s("code",[t._v("complete")]),t._v(" ("),s("code",[t._v("function")]),t._v("). Optional callback function corresponding to the end of the execution.")])]),t._v(" "),s("p",[t._v("Relationship between "),s("code",[t._v("data")]),t._v(" and the "),s("code",[t._v("Content-Type")]),t._v(":")]),t._v(" "),s("table",[s("thead",[s("tr",[s("th",[s("code",[t._v("data")])]),t._v(" "),s("th",[s("code",[t._v("Content-Type")])]),t._v(" "),s("th",[t._v("Description")])])]),t._v(" "),s("tbody",[s("tr",[s("td",[s("code",[t._v("string")])]),t._v(" "),s("td",[t._v("(not set)")]),t._v(" "),s("td",[t._v("The default value of "),s("code",[t._v("Content-Type")]),t._v(" is "),s("code",[t._v("text/plain")]),t._v(", and the value of "),s("code",[t._v("data")]),t._v(" is used as the body of the request.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("string")])]),t._v(" "),s("td",[t._v("(Any type)")]),t._v(" "),s("td",[t._v("The value of "),s("code",[t._v("data")]),t._v(" is used as the request body.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("object")])]),t._v(" "),s("td",[t._v("(not set)")]),t._v(" "),s("td",[t._v("The default value of "),s("code",[t._v("Content-Type")]),t._v(" is "),s("code",[t._v("application/x-www-form-urlencoded")]),t._v(".")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("object")])]),t._v(" "),s("td",[s("code",[t._v("application/x-www-form-urlencoded")])]),t._v(" "),s("td",[t._v("The value of "),s("code",[t._v("data")]),t._v(" is encoded based on the URL rule and is used as the request body.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("object")])]),t._v(" "),s("td",[t._v("(Any type other than "),s("code",[t._v("application/x-www-form-urlencoded")]),t._v(")")]),t._v(" "),s("td",[s("code",[t._v("data")]),t._v(" is converted into a character string as the request body.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("ArrayBuffer")])]),t._v(" "),s("td",[t._v("(not set)")]),t._v(" "),s("td",[t._v("The default value of "),s("code",[t._v("Content-Type")]),t._v(" is "),s("code",[t._v("application/octet-stream")]),t._v(", and the value of "),s("code",[t._v("data")]),t._v(" is used as the request body.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("ArrayBuffer")])]),t._v(" "),s("td",[t._v("(any type)")]),t._v(" "),s("td",[t._v("The value of "),s("code",[t._v("data")]),t._v(" is used as the request body.")])])])]),t._v(" "),s("p",[t._v("Relationship between "),s("code",[t._v("responseType")]),t._v(" and "),s("code",[t._v("data")]),t._v(" in "),s("code",[t._v("success")]),t._v(":")]),t._v(" "),s("table",[s("thead",[s("tr",[s("th",[s("code",[t._v("responseType")])]),t._v(" "),s("th",[s("code",[t._v("data")])]),t._v(" "),s("th",[t._v("Description")])])]),t._v(" "),s("tbody",[s("tr",[s("td",[t._v("N/A")]),t._v(" "),s("td",[s("code",[t._v("string")])]),t._v(" "),s("td",[t._v("If the value of type in the header returned by the server is "),s("code",[t._v("text/*")]),t._v(", "),s("code",[t._v("application/json")]),t._v(", "),s("code",[t._v("application/javascript")]),t._v(", or "),s("code",[t._v("application/xml")]),t._v(", the value is "),s("code",[t._v("text")]),t._v(". Otherwise, the value is the URI of a temporary file.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("text")])]),t._v(" "),s("td",[s("code",[t._v("string")])]),t._v(" "),s("td",[t._v("A text is returned.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("json")])]),t._v(" "),s("td",[s("code",[t._v("object")])]),t._v(" "),s("td",[t._v("A JavaScript object is returned.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("file")])]),t._v(" "),s("td",[s("code",[t._v("string")])]),t._v(" "),s("td",[t._v("The URI of a stored temporary file is returned.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("ArrayBuffer")])]),t._v(" "),s("td",[s("code",[t._v("ArrayBuffer")])]),t._v(" "),s("td",[t._v("An ArrayBuffer object is returned.")])])])]),t._v(" "),s("p",[t._v("Example:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mytask "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" requesttask"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n url"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'https://httpbin.org/anything'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n method"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'POST'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n data"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"12313213213212"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Request success. resp = "')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("JSON")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("stringify")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" \n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Request fail. resp = "')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("JSON")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("stringify")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" \n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h3",{attrs:{id:"abort"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#abort"}},[t._v("#")]),t._v(" "),s("code",[t._v("abort()")])]),t._v(" "),s("p",[s("strong",[t._v("Method to cancel a request task.")])]),t._v(" "),s("p",[t._v("Example:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mytask"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("abort")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"events"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#events"}},[t._v("#")]),t._v(" Events")]),t._v(" "),s("p",[t._v("This service provides the following listeners:")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"#onprogressupdate-function-progress-totalbytessent-totalbytesexpectedtosend"}},[s("code",[t._v("onProgressUpdate(function({progress,totalBytesSent,totalBytesExpectedToSend}))")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#offprogressupdate"}},[s("code",[t._v("offProgressUpdate()")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#onheadersreceived-function-header"}},[s("code",[t._v("onHeadersReceived(function({header}))")])])]),t._v(" "),s("li",[s("a",{attrs:{href:"#offheadersreceived"}},[s("code",[t._v("offHeadersReceived()")])])])]),t._v(" "),s("h3",{attrs:{id:"onprogressupdate-function-progress-totalbytessent-totalbytesexpectedtosend"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#onprogressupdate-function-progress-totalbytessent-totalbytesexpectedtosend"}},[t._v("#")]),t._v(" "),s("code",[t._v("onProgressUpdate(function({progress,totalBytesSent,totalBytesExpectedToSend}))")])]),t._v(" "),s("p",[s("strong",[t._v("Method to listen to request progress change events")]),t._v(".")]),t._v(" "),s("p",[t._v("This parameter is valid only for the "),s("code",[t._v("POST")]),t._v(", "),s("code",[t._v("PUT")]),t._v(", and "),s("code",[t._v("CONNECT")]),t._v(" methods.")]),t._v(" "),s("h4",{attrs:{id:"arguments-2"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#arguments-2"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),s("p",[t._v("This method requires a callback "),s("code",[t._v("function")]),t._v(" with an "),s("code",[t._v("object")]),t._v(" as argument that has the following members:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("progress")]),t._v(" ("),s("code",[t._v("number")]),t._v("). Request sending progress, in percentage.")]),t._v(" "),s("li",[s("code",[t._v("totalBytesSent")]),t._v(" ("),s("code",[t._v("number")]),t._v("). Size of the sent data, in bytes.")]),t._v(" "),s("li",[s("code",[t._v("totalBytesExpectedToSend")]),t._v(" ("),s("code",[t._v("number")]),t._v("). Expected size of data to be sent, in bytes.")])]),t._v(" "),s("p",[t._v("Example:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mytask"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("onProgressUpdate")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Request progress update = "')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("JSON")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("stringify")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" \n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h3",{attrs:{id:"offprogressupdate"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#offprogressupdate"}},[t._v("#")]),t._v(" "),s("code",[t._v("offProgressUpdate()")])]),t._v(" "),s("p",[s("strong",[t._v("Method to cancel a listener of request progress change events")]),t._v(".")]),t._v(" "),s("p",[t._v("Example:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mytask"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("offProgressUpdate")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h3",{attrs:{id:"onheadersreceived-function-header"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#onheadersreceived-function-header"}},[t._v("#")]),t._v(" "),s("code",[t._v("onHeadersReceived(function({header}))")])]),t._v(" "),s("p",[s("strong",[t._v("Method to listen to HTTP response header events")]),t._v(".")]),t._v(" "),s("p",[t._v("This method needs to be called before the file request is completed.")]),t._v(" "),s("h4",{attrs:{id:"arguments-3"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#arguments-3"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),s("p",[t._v("This method requires a callback "),s("code",[t._v("function")]),t._v(" with an "),s("code",[t._v("object")]),t._v(" as argument that has the following member:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("header")]),t._v(" ("),s("code",[t._v("object")]),t._v("). HTTP response headers returned by the server.")])]),t._v(" "),s("p",[t._v("Example:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mytask"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("onHeadersReceived")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Request onHeaderReceived = "')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("JSON")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("stringify")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" \n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h3",{attrs:{id:"offheadersreceived"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#offheadersreceived"}},[t._v("#")]),t._v(" "),s("code",[t._v("offHeadersReceived()")])]),t._v(" "),s("p",[s("strong",[t._v("Method to cancel a listener of HTTP response headers events")]),t._v(".")]),t._v(" "),s("p",[t._v("Example:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mytask"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("offHeadersReceived")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);e.default=n.exports}}]);
\ No newline at end of file
(window.webpackJsonp=window.webpackJsonp||[]).push([[101],{543:function(t,s,e){"use strict";e.r(s);var a=e(31),n=Object(a.a)({},(function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"screen-brightness"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#screen-brightness"}},[t._v("#")]),t._v(" Screen Brightness")]),t._v(" "),e("p",[e("strong",[t._v("Control of the screen brightness.")])]),t._v(" "),e("h2",{attrs:{id:"manifest-declaration"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#manifest-declaration"}},[t._v("#")]),t._v(" Manifest Declaration")]),t._v(" "),e("p",[t._v("You need to declare the use of this API in the "),e("RouterLink",{attrs:{to:"/guide/manifest.html#features"}},[t._v("manifest's "),e("code",[t._v("features")])]),t._v(" member:")],1),t._v(" "),e("div",{staticClass:"language-json extra-class"},[e("pre",{pre:!0,attrs:{class:"language-json"}},[e("code",[e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"system.brightness"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("h2",{attrs:{id:"module-import"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#module-import"}},[t._v("#")]),t._v(" Module Import")]),t._v(" "),e("p",[t._v("Before using this service in a component, you need to "),e("RouterLink",{attrs:{to:"/guide/scripting.html#import-and-export-modules"}},[t._v("import the module")]),t._v(" in the script section of the "),e("a",{attrs:{href:"../guide/ux-documents"}},[t._v("UX document")]),t._v(".")],1),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" brightness "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("'@system.brightness'")]),t._v(" \n")])])]),e("p",[t._v("Or")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" brightness "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"@system.brightness"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h2",{attrs:{id:"methods"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#methods"}},[t._v("#")]),t._v(" Methods")]),t._v(" "),e("p",[t._v("This service has the following methods:")]),t._v(" "),e("ul",[e("li",[e("a",{attrs:{href:"#getvalue-success-fail-complete"}},[e("code",[t._v("getValue({success,fail,complete})")])])]),t._v(" "),e("li",[e("a",{attrs:{href:"#setvalue-value-success-fail-complete"}},[e("code",[t._v("setValue({value,success,fail,complete})")])])]),t._v(" "),e("li",[e("a",{attrs:{href:"#getmode-success-fail-complete"}},[e("code",[t._v("getMode({success,fail,complete})")])])]),t._v(" "),e("li",[e("a",{attrs:{href:"#setmode-mode-success-fail-complete"}},[e("code",[t._v("setMode({mode,success,fail,complete})")])])]),t._v(" "),e("li",[e("a",{attrs:{href:"#setkeepscreenon-keepscreenon-success-fail-complete"}},[e("code",[t._v("setKeepScreenOn({keepScreenOn,success,fail,complete})")])])])]),t._v(" "),e("h3",{attrs:{id:"getvalue-success-fail-complete"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#getvalue-success-fail-complete"}},[t._v("#")]),t._v(" "),e("code",[t._v("getValue({success,fail,complete})")])]),t._v(" "),e("p",[e("strong",[t._v("Method to get the current screen brightness level")]),t._v(".")]),t._v(" "),e("h4",{attrs:{id:"arguments"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("This method requires an "),e("code",[t._v("object")]),t._v(" with the following attributes:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("success")]),t._v("\t("),e("code",[t._v("function(object)")]),t._v("). Optional callback function for success. The function has an "),e("code",[t._v("object")]),t._v(" argument with the following attributes:\n"),e("ul",[e("li",[e("code",[t._v("value")]),t._v(" ("),e("code",[t._v("number")]),t._v("). Screen brightness. The value is an integer from "),e("code",[t._v("0")]),t._v(" to "),e("code",[t._v("255")]),t._v(".")])])]),t._v(" "),e("li",[e("code",[t._v("fail")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for failure.")]),t._v(" "),e("li",[e("code",[t._v("complete")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for completion.")])]),t._v(" "),e("p",[t._v("Example:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[t._v("brightness"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("getValue")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("ret")]),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 console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"handling success"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h3",{attrs:{id:"setvalue-value-success-fail-complete"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#setvalue-value-success-fail-complete"}},[t._v("#")]),t._v(" "),e("code",[t._v("setValue({value,success,fail,complete})")])]),t._v(" "),e("p",[e("strong",[t._v("Method to set the screen brightness level")]),t._v(".")]),t._v(" "),e("h4",{attrs:{id:"arguments-2"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments-2"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("This method requires an "),e("code",[t._v("object")]),t._v(" with the following attributes:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("value")]),t._v(" ("),e("code",[t._v("number")]),t._v("). Mandatory attribute with the value of the screen brightness. The value is an integer from "),e("code",[t._v("0")]),t._v(" to "),e("code",[t._v("255")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("success")]),t._v("\t("),e("code",[t._v("function()")]),t._v("). Optional callback function for success.")]),t._v(" "),e("li",[e("code",[t._v("fail")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for failure.")]),t._v(" "),e("li",[e("code",[t._v("complete")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for completion.")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("ul",[e("li",[t._v("If the "),e("code",[t._v("value")]),t._v(" parameter is "),e("code",[t._v("0")]),t._v(" or smaller, the system will apply the value "),e("code",[t._v("1")]),t._v(".")]),t._v(" "),e("li",[t._v("If the "),e("code",[t._v("value")]),t._v(" parameter is greater than "),e("code",[t._v("255")]),t._v(", the system will apply the value "),e("code",[t._v("255")]),t._v(".")]),t._v(" "),e("li",[t._v("If the "),e("code",[t._v("value")]),t._v(" parameter is a decimal number, the system will take only the integer part.")])])]),t._v(" "),e("p",[t._v("Example:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[t._v("brightness"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("setValue")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("data")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"handling success"')]),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("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("fail")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("data"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" code")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"handling fail, code="')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" code"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h3",{attrs:{id:"getmode-success-fail-complete"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#getmode-success-fail-complete"}},[t._v("#")]),t._v(" "),e("code",[t._v("getMode({success,fail,complete})")])]),t._v(" "),e("p",[e("strong",[t._v("Method to get the current setup mode of the screen brightness")]),t._v(".")]),t._v(" "),e("h4",{attrs:{id:"arguments-3"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments-3"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("This method requires an "),e("code",[t._v("object")]),t._v(" with the following attributes:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("success")]),t._v("\t("),e("code",[t._v("function(res)")]),t._v("). Optional callback function for success. The function has an "),e("code",[t._v("object")]),t._v(" argument with the following attributes:\n"),e("ul",[e("li",[e("code",[t._v("mode")]),t._v(" ("),e("code",[t._v("number")]),t._v("). Indicates the setup mode of the brightness: "),e("code",[t._v("0")]),t._v(" for manual adjustment and "),e("code",[t._v("1")]),t._v(" for automatic adjustment.")])])]),t._v(" "),e("li",[e("code",[t._v("fail")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for failure.")]),t._v(" "),e("li",[e("code",[t._v("complete")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for completion.")])]),t._v(" "),e("p",[t._v("Example:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[t._v("brightness"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("getMode")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("ret")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"mode is: "')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" ret"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mode"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h3",{attrs:{id:"setmode-mode-success-fail-complete"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#setmode-mode-success-fail-complete"}},[t._v("#")]),t._v(" "),e("code",[t._v("setMode({mode,success,fail,complete})")])]),t._v(" "),e("p",[e("strong",[t._v("Method to set the screen brightness adjustment mode (manual or automatic)")]),t._v(".")]),t._v(" "),e("h4",{attrs:{id:"arguments-4"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments-4"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("This method requires an "),e("code",[t._v("object")]),t._v(" with the following attributes:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("mode")]),t._v(" ("),e("code",[t._v("number")]),t._v("). Mandatory attribute with the mode of the screen brightness adjustment. The value is an integer: "),e("code",[t._v("0")]),t._v(" for manual adjustment, and "),e("code",[t._v("1")]),t._v(" for an automatic control.")]),t._v(" "),e("li",[e("code",[t._v("success")]),t._v("\t("),e("code",[t._v("function()")]),t._v("). Optional callback function for success.")]),t._v(" "),e("li",[e("code",[t._v("fail")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for failure.")]),t._v(" "),e("li",[e("code",[t._v("complete")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for completion.")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("ul",[e("li",[t._v("If the "),e("code",[t._v("value")]),t._v(" parameter is "),e("code",[t._v("0")]),t._v(" or smaller, the system will apply the value "),e("code",[t._v("1")]),t._v(".")]),t._v(" "),e("li",[t._v("If the "),e("code",[t._v("value")]),t._v(" parameter is greater than "),e("code",[t._v("255")]),t._v(", the system will apply the value "),e("code",[t._v("255")]),t._v(".")]),t._v(" "),e("li",[t._v("If the "),e("code",[t._v("value")]),t._v(" parameter is a decimal number, the system will take only the integer part.")])])]),t._v(" "),e("p",[t._v("Example:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[t._v("brightness"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("setMode")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n mode"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("data")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"handling success"')]),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("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("fail")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("data"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" code")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"handling fail, code="')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" code"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h3",{attrs:{id:"setkeepscreenon-keepscreenon-success-fail-complete"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#setkeepscreenon-keepscreenon-success-fail-complete"}},[t._v("#")]),t._v(" "),e("code",[t._v("setKeepScreenOn({keepScreenOn,success,fail,complete})")])]),t._v(" "),e("p",[e("strong",[t._v("Method to keep the screen on")]),t._v(".")]),t._v(" "),e("h4",{attrs:{id:"arguments-5"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments-5"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("This method requires an "),e("code",[t._v("object")]),t._v(" with the following attributes:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("keepScreenOn")]),t._v(" ("),e("code",[t._v("boolean")]),t._v("). Mandatory flag that indicates if the system need to keep the screen steady on ("),e("code",[t._v("true")]),t._v(") or not.")]),t._v(" "),e("li",[e("code",[t._v("success")]),t._v("\t("),e("code",[t._v("function()")]),t._v("). Optional callback function for success.")]),t._v(" "),e("li",[e("code",[t._v("fail")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for failure.")]),t._v(" "),e("li",[e("code",[t._v("complete")]),t._v(" ("),e("code",[t._v("function()")]),t._v("). Optional callback function for completion.")])]),t._v(" "),e("p",[t._v("Example:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[t._v("brightness"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("setKeepScreenOn")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n keepScreenOn"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),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 punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token template-string"}},[e("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v("handling success")]),e("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("fail")]),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("data"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" code")]),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 punctuation"}},[t._v("}")]),t._v(" \n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=n.exports}}]);
\ No newline at end of file
(window.webpackJsonp=window.webpackJsonp||[]).push([[102],{544:function(t,s,a){"use strict";a.r(s);var e=a(31),n=Object(e.a)({},(function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"sensors"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#sensors"}},[t._v("#")]),t._v(" Sensors")]),t._v(" "),a("p",[a("strong",[t._v("Management of device's sensors")]),t._v(" (accelerometer, compass, proximity, light, step counter...).")]),t._v(" "),a("h2",{attrs:{id:"manifest-declaration"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#manifest-declaration"}},[t._v("#")]),t._v(" Manifest Declaration")]),t._v(" "),a("p",[t._v("You need to declare the use of this API in the "),a("RouterLink",{attrs:{to:"/guide/manifest.html#features"}},[t._v("manifest's "),a("code",[t._v("features")])]),t._v(" member:")],1),t._v(" "),a("div",{staticClass:"language-json extra-class"},[a("pre",{pre:!0,attrs:{class:"language-json"}},[a("code",[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"system.sensor"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("h2",{attrs:{id:"module-import"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#module-import"}},[t._v("#")]),t._v(" Module Import")]),t._v(" "),a("p",[t._v("Before using this service in a component, you need to "),a("RouterLink",{attrs:{to:"/guide/scripting.html#import-and-export-modules"}},[t._v("import the module")]),t._v(" in the script section of the "),a("a",{attrs:{href:"../guide/ux-documents"}},[t._v("UX document")]),t._v(".")],1),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" sensor "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'@system.sensor'")]),t._v(" \n")])])]),a("p",[t._v("Or")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" sensor "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"@system.sensor"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h2",{attrs:{id:"methods"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#methods"}},[t._v("#")]),t._v(" Methods")]),t._v(" "),a("p",[t._v("This service has the following methods:")]),t._v(" "),a("ul",[a("li",[a("a",{attrs:{href:"#subscribeaccelerometer-interval-callback"}},[a("code",[t._v("subscribeAccelerometer({interval,callback})")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#unsubscribeaccelerometer"}},[a("code",[t._v("unsubscribeAccelerometer()")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#subscribecompass-callback"}},[a("code",[t._v("subscribeCompass({callback})")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#unsubscribecompass"}},[a("code",[t._v("unsubscribeCompass()")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#subscribeproximity-callback"}},[a("code",[t._v("subscribeProximity({callback})")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#unsubscribeproximity"}},[a("code",[t._v("unsubscribeProximity()")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#subscribelight-callback"}},[a("code",[t._v("subscribeLight({callback})")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#unsubscribelight"}},[a("code",[t._v("unsubscribeLight()")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#subscribestepcounter-callback"}},[a("code",[t._v("subscribeStepCounter({callback})")])])]),t._v(" "),a("li",[a("a",{attrs:{href:"#unsubscribestepcounter"}},[a("code",[t._v("unsubscribeStepCounter()")])])])]),t._v(" "),a("h3",{attrs:{id:"subscribeaccelerometer-interval-callback"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#subscribeaccelerometer-interval-callback"}},[t._v("#")]),t._v(" "),a("code",[t._v("subscribeAccelerometer({interval,callback})")])]),t._v(" "),a("p",[a("strong",[t._v("Listens to gravity sensor data.")])]),t._v(" "),a("p",[t._v("If you call this method multiple times, only the last one will take effect.")]),t._v(" "),a("h4",{attrs:{id:"arguments"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#arguments"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),a("p",[t._v("This method requires an "),a("code",[t._v("object")]),t._v(" with the following attributes:")]),t._v(" "),a("ul",[a("li",[a("code",[t._v("interval")]),t._v(" ("),a("code",[t._v("string")]),t._v("). Optional attribute with the frequency to run the listener function. The possible values are:\n"),a("ul",[a("li",[a("code",[t._v("game")]),t._v(": every 20 ms.")]),t._v(" "),a("li",[a("code",[t._v("ui")]),t._v(": every 60 ms.")]),t._v(" "),a("li",[a("code",[t._v("normal")]),t._v(": every 200 ms (by default).")])])]),t._v(" "),a("li",[a("code",[t._v("callback")]),t._v(" ("),a("code",[t._v("function({x,y,z})")]),t._v("). Mandatory attribute with the callback function after the sensor values changes. This function is executed every 200 ms. The function has an "),a("code",[t._v("object")]),t._v(" argument with the following attributes:\n"),a("ul",[a("li",[a("code",[t._v("x")]),t._v(" ("),a("code",[t._v("number")]),t._v("): X coordinate.")]),t._v(" "),a("li",[a("code",[t._v("y")]),t._v(" ("),a("code",[t._v("number")]),t._v("): Y coordinate.")]),t._v(" "),a("li",[a("code",[t._v("z")]),t._v(" ("),a("code",[t._v("number")]),t._v("): Z coordinate.")])])])]),t._v(" "),a("p",[t._v("Example:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("sensor"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("subscribeAccelerometer")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n interval"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"normal"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" \n "),a("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("callback")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("ret")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("console"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token template-string"}},[a("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token interpolation"}},[a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("ret"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("x"),a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v(", ")]),a("span",{pre:!0,attrs:{class:"token interpolation"}},[a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("ret"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("y"),a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v(", ")]),a("span",{pre:!0,attrs:{class:"token interpolation"}},[a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("ret"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("z"),a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h3",{attrs:{id:"unsubscribeaccelerometer"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#unsubscribeaccelerometer"}},[t._v("#")]),t._v(" "),a("code",[t._v("unsubscribeAccelerometer()")])]),t._v(" "),a("p",[a("strong",[t._v("Cancels listening to gravity sensor data.")])]),t._v(" "),a("p",[t._v("Example:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("sensor"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("unsubscribeAccelerometer")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h3",{attrs:{id:"subscribecompass-callback"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#subscribecompass-callback"}},[t._v("#")]),t._v(" "),a("code",[t._v("subscribeCompass({callback})")])]),t._v(" "),a("p",[a("strong",[t._v("Listens to compass data changes.")])]),t._v(" "),a("p",[t._v("If you call this method multiple times, only the last one will take effect.")]),t._v(" "),a("h4",{attrs:{id:"arguments-2"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#arguments-2"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),a("p",[t._v("This method requires an "),a("code",[t._v("object")]),t._v(" with the following attribute:")]),t._v(" "),a("ul",[a("li",[a("code",[t._v("callback")]),t._v(" ("),a("code",[t._v("function({direction,accuracy})")]),t._v("). Mandatory attribute with the callback function after the sensor values changes. The function has an "),a("code",[t._v("object")]),t._v(" argument with the following attributes:\n"),a("ul",[a("li",[a("code",[t._v("direction")]),t._v(" ("),a("code",[t._v("number")]),t._v("): Decimal with the latest direction in degrees.")]),t._v(" "),a("li",[a("code",[t._v("accuracy")]),t._v(" ("),a("code",[t._v("number")]),t._v("): Integer with the current precision of the sensor. Values are:\n"),a("ul",[a("li",[a("code",[t._v("-1")]),t._v(": The value is unreliable and the sensor is disconnected.")]),t._v(" "),a("li",[a("code",[t._v("0")]),t._v(": The value is unreliable and the cause is unknown.")]),t._v(" "),a("li",[a("code",[t._v("1")]),t._v(": low precision.")]),t._v(" "),a("li",[a("code",[t._v("2")]),t._v(": medium precision.")]),t._v(" "),a("li",[a("code",[t._v("3")]),t._v(": high precision.")])])])])])]),t._v(" "),a("p",[t._v("Example:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("sensor"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("subscribeCompass")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n "),a("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("callback")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("ret")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token template-string"}},[a("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token interpolation"}},[a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("ret"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("direction"),a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v(", ")]),a("span",{pre:!0,attrs:{class:"token interpolation"}},[a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("ret"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accuracy"),a("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h3",{attrs:{id:"unsubscribecompass"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#unsubscribecompass"}},[t._v("#")]),t._v(" "),a("code",[t._v("unsubscribeCompass()")])]),t._v(" "),a("p",[a("strong",[t._v("Cancels listening to compass data changes.")])]),t._v(" "),a("p",[t._v("Example:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("sensor"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("unsubscribeCompass")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h3",{attrs:{id:"subscribeproximity-callback"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#subscribeproximity-callback"}},[t._v("#")]),t._v(" "),a("code",[t._v("subscribeProximity({callback})")])]),t._v(" "),a("p",[a("strong",[t._v("Listens to proximity sensor data changes.")])]),t._v(" "),a("p",[t._v("If you call this method multiple times, only the last one will take effect.")]),t._v(" "),a("h4",{attrs:{id:"arguments-3"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#arguments-3"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),a("p",[t._v("This method requires an "),a("code",[t._v("object")]),t._v(" with the following attribute:")]),t._v(" "),a("ul",[a("li",[a("code",[t._v("callback")]),t._v(" ("),a("code",[t._v("function({distance})")]),t._v("). Mandatory attribute with the callback function after the sensor values changes. The function has an "),a("code",[t._v("object")]),t._v(" argument with the following attribute:\n"),a("ul",[a("li",[a("code",[t._v("distance")]),t._v(" ("),a("code",[t._v("number")]),t._v("): Distance to the device in centimeters.")])])])]),t._v(" "),a("p",[t._v("Example:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("sensor"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("subscribeProximity")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n "),a("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("callback")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),a("span",{pre:!0,attrs:{class:"token punctuation