Skip to main content

Other Plateau UI Methods

Two-Way Binding

Two-way Binding is a common requirement that allows you to connect data to specific locations and automatically update related fields when changes occur. You can utilize the quick.Quick.bind method for this purpose.

You can apply this method to the quick.Quick.bind method for page store, bag store, and global store. It also supports Block and Rendering component usage.

To use the method:

  • Declare the method in the PreRender stage, and store the bound object.
  • Specify the bound fields as a string array in the second parameter.

quick.Quick.bind({ bindedObject, fields }: {

bindedObject: string;

fields: object | string[];
})


quick.Quick.bind({ bindedObject: "store", fields: ["testField"] });

Example Usage:

Two-Way Binding

Deep Copy Object

Deep Copy Object refers to the process of creating a new object with a deep cloning technique. Any changes made to the new object will not affect the original object. This method is particularly useful for scenarios where you need to duplicate complex data structures.

quick.Quick.copy(obj: any)

let obj = [{param1:'value1', param2:'value2'},{param3:'value3', param4:'value4'}]
let newCopiedObj = quick.Quick.copy(obj)
newCopiedObj.push({param5:'value5', param6:'value6'})
quick.EM.trace(newCopiedObj)
quick.EM.trace(obj)

Url.getUrl()

Get URL of the current page.

quick.Url.getUrl() : string

   let pageUrl = quick.Url.getUrl();

Url.getDeepLinkParams()

Get the querystring part of the current page's URL, including the question mark (?).

quick.Url.getDeepLinkParams() : Record<string, string>

   let pageUrlParams = quick.Url.getDeepLinkParams();

Encode and Decode

btoa() is used to encode a string into base-64 format. This is particularly useful for encoding binary data as a string.

let encodedString = quick.encoding.btoa(stringToEncode: string)

atob() is used to decode a base-64 encoded string. This is the counterpart to btoa(), which encodes a string into base-64.

let baseString = quick.encoding.atob(encodedString: string)

Example Usage:

encoding

Crypto.randomUUID()

randomUUID() method of the Crypto interface is used to generate a v4 UUID by using a cryptographically secure random number generator.

https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

crypto.randomUUID();

copyToClipboard()

copyToClipboard() method allows copying a specified value to the clipboard.

 quick.Quick.copyToClipboard(value:string)
quick.Quick.copyToClipboard(components.myTextField.qValue);

getCurrentPosition()

getCurrentPosition() method is provided by the Geolocation interface, designed to retrieve the current location of the device. This can be useful for websites and apps to offer personalized content or results.

 quick.Quick.getCurrentPosition(): ILocationPosition

async function getCurrentPosition() {
let location = await quick.Quick.getCurrentPosition();
quick.EM.trace("currentPosition");
if(location.isSuccess){
let positionSuccess = location.positionSuccess;
let latitude = positionSuccess.coords.latitude;
let longitude = positionSuccess.coords.longitude;
}
else {
let positionError = location.positionError;
let errorCode = positionError.code;
let errorMessage = positionError.message;
}
}
getCurrentPosition();

Screen Offset

XOffset

XOffset method allows you to determine the horizontal (left or right) scrolling of a screen or element.

quick.Quick.screen.XOffset

YOffset

YOffset method helps you figure out the vertical (up or down) scrolling of a screen or element.

quick.Quick.screen.YOffset

scrollIntoView

scrollIntoView method scrolls the webpage to bring a specific element into the visible area of the browser.

quick.Quick.screen.scrollIntoView(component: IComponent)

toTop

toTop method scrolls the document to the top of the page.

quick.Quick.screen.toTop()

Example Usage:

scrollButton

loading.show() and loading.hide()

loading.show() and loading.hide() methods allow loading to be displayed and closed.

 quick.Quick.loading.show() 
quick.Quick.loading.hide()

authentication.getIamToken()

authentication.getIamToken() method allows to get iam token information.

 quick.Quick.authentication.getIamToken()

async function getIamToken() {
let iamToken = await quick.Quick.authentication.getIamToken();
}
getIamToken();

shareData()

Note

For now, it is only available for mobile usage.

The shareData method enables file and URL sharing on mobile devices.

let sharedDataInfo: ISharedDataInfo = {
data: "https://developer.mozilla.org",
name: "example"
}
quick.Quick.shareData(sharedDataInfo);

Environment

You can define any value related to the application with environment and access this value from the page.

  • In the Settings File, define any value related to the application under the environment tag.

    environment:
    userInfo:
    personalInfo:
    name: "Ahmet"
    surname: "Yılmaz"
    educationInfo:
    level: "lisans"
  • The environment value is accessed within the page as follows.

    let userInfo = quick.Quick.environment.variable["userInfo"];