File.prototype.prefixVar()

Prefix a variable name for use in a URL.

Syntax

file.prefixVar(name string) string

Parameters

name string

Name of the variable to have prefixed.

Description

Prefix a variable name with a string unique to the file to be used in URL query parameters. Currently it has the form i123.name, but that may change in the future.

The purpose of prefixing variables is applying a namespace so that parameters can be passed to individual applications instead of all of them. This way there may be 2 instances of the same application on the same page without having conflicts.

It is guaranteed that calling .prefixVar() on different files will return different results. Think of addressing parameters to apps rendering contents on a page.

Examples

Basic example.

Documenting the prefix char.

Documenting the format with a regular expression.