js.createNS: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page js.createNS to Js.createNS without leaving a redirect: Converting page title to first-letter uppercase) |
m (Cleaned up syntax/grammar) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
|version=1.10.0 | |version=1.10.0 | ||
|description= | |description= | ||
Create (or recreate) a | Create (or recreate) a JavaScript namespace. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
js.createNS(namespace) | js.createNS(namespace) | ||
js.createNS(namespace, trusted) | js.createNS(namespace, trusted) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
* {{code|namespace}} - The namespace to (re)create. If the namespace exists, this must be called from a trusted context. | * {{code|namespace}} - The namespace to (re)create. If the namespace already exists, this must be called from a trusted context. | ||
* {{code|trusted}} - If the namespace created should be a trusted namespace | * {{code|trusted}} - If the namespace created should be a trusted namespace. Defaults to {{true}} if called from a trusted context. | ||
|example= | |example= | ||
Using {{code|js. | Using {{code| js.createNS}} on an {{code|expression}}. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: js.createNS("demo", true)] | [r: js.createNS("demo", true)] | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
Line 34: | Line 29: | ||
{{func|js.evalNS}}<br/> | {{func|js.evalNS}}<br/> | ||
{{func|js.removeNS}} | {{func|js.removeNS}} | ||
}} | }} | ||
[[Category:Javascript Function]] | [[Category:Javascript Function]] |
Latest revision as of 23:59, 7 July 2023
This article describes a feature or macro function that is experimental and may be subject to change.
js.createNS() Function
• Introduced in version 1.10.0
Create (or recreate) a JavaScript namespace.
Usage
js.createNS(namespace)
js.createNS(namespace, trusted)
Parameters
namespace
- The namespace to (re)create. If the namespace already exists, this must be called from a trusted context.trusted
- If the namespace created should be a trusted namespace. Defaults totrue
(1
) if called from a trusted context.
Example
Using
js.createNS
on an expression
.
[r: js.createNS("demo", true)]