Files
liquidjs/api/classes/context_context_.context.html
T

390 lines
34 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head prefix="og: http://ogp.me/ns#">
<meta charset="utf-8">
<title>Class: Context | LiquidJS</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="LiquidJS is a simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net/">
<link rel="manifest" href="/manifest.json">
<!-- Canonical links -->
<link rel="canonical" href="https://liquidjs.com/api/classes/context_context_.context.html">
<!-- Alternative links -->
<link rel="alternative" hreflang="en" href="https://liquidjs.com/api/classes/context_context_.context">
<link rel="alternative" hreflang="zh-cn" href="https://liquidjs.com/zh-cn/api/classes/context_context_.context">
<!-- Icon -->
<link rel="apple-touch-icon" sizes="57x57" href="../../icon/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="../../icon/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="72x72" href="../../icon/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="144x144" href="../../icon/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="60x60" href="../../icon/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="120x120" href="../../icon/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="76x76" href="../../icon/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="152x152" href="../../icon/apple-touch-icon-152x152.png">
<link rel="icon" type="image/png" href="../../icon/favicon-196x196.png" sizes="196x196">
<link rel="icon" type="image/png" href="../../icon/favicon-160x160.png" sizes="160x160">
<link rel="icon" type="image/png" href="../../icon/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="../../icon/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="../../icon/favicon-32x32.png" sizes="32x32">
<meta name="msapplication-TileColor" content="#2f83cd">
<meta name="msapplication-TileImage" content="../../icon/mstile-144x144.png">
<link rel="stylesheet" href="../../css/navy.css">
<link rel="alternate" href="../../atom.xml" title="LiquidJS" type="application/atom+xml">
<meta name="generator" content="Hexo 5.4.0"></head>
<body>
<div id="container">
<header id="header" class="wrapper">
<div id="header-inner" class="inner">
<h1 id="logo-wrap">
<a href="../../index.html" id="logo">LiquidJS</a>
</h1>
<nav id="main-nav">
<a href="../../tutorials/intro-to-liquid.html" class="main-nav-link">Tutorials</a><a href="../../tags/overview.html" class="main-nav-link">Tags</a><a href="../../filters/overview.html" class="main-nav-link">Filters</a><a href="../../playground.html" class="main-nav-link">Playground</a><a href="../../api/classes/liquid_.liquid.html" class="main-nav-link">API</a>
<div id="search-input-wrap">
<i id="search-input-icon" class="icon-search"></i>
<input type="search" id="search-input" placeholder="Search...">
</div>
</nav>
<div class="main-nav-link icon-nav-link">
<label><i class="icon-network"></i> <span class="icon-nav-title">English</span></label>
<select id="lang-select" data-canonical="api/classes/context_context_.context.html">
<option value="en" selected>English</option>
<option value="zh-cn">简体中文</option>
</select>
</div>
<a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs" class="main-nav-link icon-nav-link"><i class="icon-github"></i> <span class="icon-nav-title">Github</span></a>
<a target="_blank" rel="noopener external nofollow noreferrer" href="https://opencollective.com/liquidjs" class="main-nav-link icon-nav-link"><i class="icon-opencollective"></i> <span class="icon-nav-title">Support</span></a>
<a id="mobile-nav-toggle">
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
</a>
</div>
</header>
<div id="content-wrap">
<div id="content" class="wrapper">
<div id="content-inner">
<aside id="sidebar" role="navigation">
<div class="inner">
<strong class="sidebar-title">Quick Entry</strong><a href="../classes/liquid_.liquid.html" class="sidebar-link">Liquid</a><a href="../interfaces/liquid_options_.liquidoptions.html" class="sidebar-link">LiquidOptions</a><a href="../interfaces/fs_fs_.fs.html" class="sidebar-link">FS</a><a href="../interfaces/cache_cache_.cache.html" class="sidebar-link">Cache</a><strong class="sidebar-title">Classes</strong><a href="../classes/drop_blank_drop_.blankdrop.html" class="sidebar-link">BlankDrop</a><a href="../classes/context_context_.context.html" class="sidebar-link">Context</a><a href="../classes/tokens_delimited_token_.delimitedtoken.html" class="sidebar-link">DelimitedToken</a><a href="../classes/drop_drop_.drop.html" class="sidebar-link">Drop</a><a href="../classes/drop_empty_drop_.emptydrop.html" class="sidebar-link">EmptyDrop</a><a href="../classes/render_expression_.expression.html" class="sidebar-link">Expression</a><a href="../classes/tokens_filter_token_.filtertoken.html" class="sidebar-link">FilterToken</a><a href="../classes/drop_forloop_drop_.forloopdrop.html" class="sidebar-link">ForloopDrop</a><a href="../classes/tokens_html_token_.htmltoken.html" class="sidebar-link">HTMLToken</a><a href="../classes/tokens_hash_token_.hashtoken.html" class="sidebar-link">HashToken</a><a href="../classes/cache_lru_.lru.html" class="sidebar-link">LRU</a><a href="../classes/liquid_.liquid.html" class="sidebar-link">Liquid</a><a href="../classes/tokens_literal_token_.literaltoken.html" class="sidebar-link">LiteralToken</a><a href="../classes/drop_null_drop_.nulldrop.html" class="sidebar-link">NullDrop</a><a href="../classes/tokens_number_token_.numbertoken.html" class="sidebar-link">NumberToken</a><a href="../classes/tokens_operator_token_.operatortoken.html" class="sidebar-link">OperatorToken</a><a href="../classes/tokens_output_token_.outputtoken.html" class="sidebar-link">OutputToken</a><a href="../classes/util_error_.parseerror.html" class="sidebar-link">ParseError</a><a href="../classes/parser_parse_stream_.parsestream.html" class="sidebar-link">ParseStream</a><a href="../classes/parser_parser_.parser.html" class="sidebar-link">Parser</a><a href="../classes/tokens_property_access_token_.propertyaccesstoken.html" class="sidebar-link">PropertyaccessToken</a><a href="../classes/tokens_quoted_token_.quotedtoken.html" class="sidebar-link">QuotedToken</a><a href="../classes/tokens_range_token_.rangetoken.html" class="sidebar-link">RangeToken</a><a href="../classes/render_render_.render.html" class="sidebar-link">Render</a><a href="../classes/util_error_.rendererror.html" class="sidebar-link">RenderError</a><a href="../classes/drop_tablerowloop_drop_.tablerowloopdrop.html" class="sidebar-link">TablerowloopDrop</a><a href="../classes/tokens_tag_token_.tagtoken.html" class="sidebar-link">TagToken</a><a href="../classes/tokens_token_.token.html" class="sidebar-link">Token</a><a href="../classes/util_error_.tokenizationerror.html" class="sidebar-link">TokenizationError</a><a href="../classes/parser_tokenizer_.tokenizer.html" class="sidebar-link">Tokenizer</a><a href="../classes/tokens_word_token_.wordtoken.html" class="sidebar-link">WordToken</a><strong class="sidebar-title">Enums</strong><a href="../enums/context_block_mode_.blockmode.html" class="sidebar-link">BlockMode</a><a href="../enums/parser_token_kind_.tokenkind.html" class="sidebar-link">TokenKind</a><strong class="sidebar-title">Interfaces</strong><a href="../interfaces/cache_cache_.cache.html" class="sidebar-link">Cache</a><a href="../interfaces/template_filter_filter_impl_options_.filterimploptions.html" class="sidebar-link">FilterImplOptions</a><a href="../interfaces/fs_fs_.fs.html" class="sidebar-link">FS</a><a href="../interfaces/liquid_options_.liquidoptions.html" class="sidebar-link">LiquidOptions</a><a href="../interfaces/liquid_options_.normalizedfulloptions.html" class="sidebar-link">NormalizedFullOptions</a><a href="../interfaces/context_scope_.plainobject.html" class="sidebar-link">PlainObject</a><a href="../interfaces/template_tag_tag_impl_options_.tagimploptions.html" class="sidebar-link">TagImplOptions</a>
</div>
</aside>
<article class="article-container" itemscope itemtype="http://schema.org/Article">
<div class="article-inner">
<div class="article">
<div class="inner">
<header class="article-header">
<h1 class="article-title" itemprop="name">Class: Context</h1>
<a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/issues/new?title=docs:&body=URL: https%3A%2F%2Fliquidjs.com%2Fapi%2Fclasses%2Fcontext_context_.context.html&labels=docs" class="article-edit-link" title="Report problems"><i class="icon-chat-bubble-dots"></i></a>
</header>
<div class="article-content" itemprop="articleBody">
<h2 id="Hierarchy" class="article-heading"><a href="#Hierarchy" class="headerlink" title="Hierarchy"></a>Hierarchy<a class="article-anchor" href="#Hierarchy" aria-hidden="true"></a></h2><ul>
<li><strong>Context</strong></li>
</ul>
<h2 id="Constructors" class="article-heading"><a href="#Constructors" class="headerlink" title="Constructors"></a>Constructors<a class="article-anchor" href="#Constructors" aria-hidden="true"></a></h2><h3 id="constructor-NaN" class="article-heading"><a href="#constructor-NaN" class="headerlink" title="constructor"></a>constructor<a class="article-anchor" href="#constructor-NaN" aria-hidden="true"></a></h3><p>+ <strong>new Context</strong>(<code>env</code>: object, <code>opts</code>: <a href="../interfaces/liquid_options_.normalizedfulloptions.html">NormalizedFullOptions</a>, <code>renderOptions</code>: <a href="../interfaces/liquid_options_.renderoptions.html">RenderOptions</a>): <em><a href="context_context_.context.html">Context</a></em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L35">src/context/context.ts:35</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody><tr>
<td><code>env</code></td>
<td>object</td>
<td>&#x7b;&#x7d;</td>
</tr>
<tr>
<td><code>opts</code></td>
<td><a href="../interfaces/liquid_options_.normalizedfulloptions.html">NormalizedFullOptions</a></td>
<td>defaultOptions</td>
</tr>
<tr>
<td><code>renderOptions</code></td>
<td><a href="../interfaces/liquid_options_.renderoptions.html">RenderOptions</a></td>
<td>&#x7b;&#x7d;</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em><a href="context_context_.context.html">Context</a></em></p>
<h2 id="Properties" class="article-heading"><a href="#Properties" class="headerlink" title="Properties"></a>Properties<a class="article-anchor" href="#Properties" aria-hidden="true"></a></h2><h3 id="environments" class="article-heading"><a href="#environments" class="headerlink" title="environments"></a>environments<a class="article-anchor" href="#environments" aria-hidden="true"></a></h3><p><strong>environments</strong>: <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L22">src/context/context.ts:22</a></em></p>
<p>user passed in scope<br><code>&#123;% increment %&#125;</code>, <code>&#123;% decrement %&#125;</code> changes this scope,<br>whereas <code>&#123;% capture %&#125;</code>, <code>&#123;% assign %&#125;</code> only hide this scope</p>
<hr>
<h3 id="globals" class="article-heading"><a href="#globals" class="headerlink" title="globals"></a>globals<a class="article-anchor" href="#globals" aria-hidden="true"></a></h3><p><strong>globals</strong>: <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L26">src/context/context.ts:26</a></em></p>
<p>global scope used as fallback for missing variables</p>
<hr>
<h3 id="opts" class="article-heading"><a href="#opts" class="headerlink" title="opts"></a>opts<a class="article-anchor" href="#opts" aria-hidden="true"></a></h3><p><strong>opts</strong>: <em><a href="../interfaces/liquid_options_.normalizedfulloptions.html">NormalizedFullOptions</a></em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L31">src/context/context.ts:31</a></em></p>
<p>The normalized liquid options object</p>
<hr>
<h3 id="Private-registers" class="article-heading"><a href="#Private-registers" class="headerlink" title="Private registers"></a><code>Private</code> registers<a class="article-anchor" href="#Private-registers" aria-hidden="true"></a></h3><p><strong>registers</strong>: <em>object</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L16">src/context/context.ts:16</a></em></p>
<h4 id="Type-declaration" class="article-heading"><a href="#Type-declaration" class="headerlink" title="Type declaration:"></a>Type declaration:<a class="article-anchor" href="#Type-declaration" aria-hidden="true"></a></h4><hr>
<h3 id="Private-scopes" class="article-heading"><a href="#Private-scopes" class="headerlink" title="Private scopes"></a><code>Private</code> scopes<a class="article-anchor" href="#Private-scopes" aria-hidden="true"></a></h3><p><strong>scopes</strong>: <em><a href="../modules/context_scope_.html#scope">Scope</a>[]</em> = [&#x7b;&#x7d;]</p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L15">src/context/context.ts:15</a></em></p>
<p>insert a Context-level empty scope,<br>for tags like <code>&#123;% capture %&#125;</code> <code>&#123;% assign %&#125;</code> to operate</p>
<hr>
<h3 id="strictVariables" class="article-heading"><a href="#strictVariables" class="headerlink" title="strictVariables"></a>strictVariables<a class="article-anchor" href="#strictVariables" aria-hidden="true"></a></h3><p><strong>strictVariables</strong>: <em>boolean</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L35">src/context/context.ts:35</a></em></p>
<p>Throw when accessing undefined variable?</p>
<hr>
<h3 id="sync" class="article-heading"><a href="#sync" class="headerlink" title="sync"></a>sync<a class="article-anchor" href="#sync" aria-hidden="true"></a></h3><p><strong>sync</strong>: <em>boolean</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L27">src/context/context.ts:27</a></em></p>
<h2 id="Methods" class="article-heading"><a href="#Methods" class="headerlink" title="Methods"></a>Methods<a class="article-anchor" href="#Methods" aria-hidden="true"></a></h2><h3 id="bottom" class="article-heading"><a href="#bottom" class="headerlink" title="bottom"></a>bottom<a class="article-anchor" href="#bottom" aria-hidden="true"></a></h3><p><strong>bottom</strong>(): <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L79">src/context/context.ts:79</a></em></p>
<p><strong>Returns:</strong> <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<hr>
<h3 id="Private-findScope" class="article-heading"><a href="#Private-findScope" class="headerlink" title="Private findScope"></a><code>Private</code> findScope<a class="article-anchor" href="#Private-findScope" aria-hidden="true"></a></h3><p><strong>findScope</strong>(<code>key</code>: string | number): <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L82">src/context/context.ts:82</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>key</code></td>
<td>string &#124; number</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<hr>
<h3 id="get" class="article-heading"><a href="#get" class="headerlink" title="get"></a>get<a class="article-anchor" href="#get" aria-hidden="true"></a></h3><p><strong>get</strong>(<code>paths</code>: <a href="../modules/context_context_.html#propertykey">PropertyKey</a>[]): <em>object</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L59">src/context/context.ts:59</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>paths</code></td>
<td><a href="../modules/context_context_.html#propertykey">PropertyKey</a>[]</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em>object</em></p>
<hr>
<h3 id="getAll" class="article-heading"><a href="#getAll" class="headerlink" title="getAll"></a>getAll<a class="article-anchor" href="#getAll" aria-hidden="true"></a></h3><p><strong>getAll</strong>(): <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L55">src/context/context.ts:55</a></em></p>
<p><strong>Returns:</strong> <em><a href="../modules/context_scope_.html#scope">Scope</a></em></p>
<hr>
<h3 id="getFromScope" class="article-heading"><a href="#getFromScope" class="headerlink" title="getFromScope"></a>getFromScope<a class="article-anchor" href="#getFromScope" aria-hidden="true"></a></h3><p><strong>getFromScope</strong>(<code>scope</code>: object, <code>paths</code>: <a href="../modules/context_context_.html#propertykey">PropertyKey</a>[] | string): <em>object</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L63">src/context/context.ts:63</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>scope</code></td>
<td>object</td>
</tr>
<tr>
<td><code>paths</code></td>
<td><a href="../modules/context_context_.html#propertykey">PropertyKey</a>[] &#124; string</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em>object</em></p>
<hr>
<h3 id="getRegister" class="article-heading"><a href="#getRegister" class="headerlink" title="getRegister"></a>getRegister<a class="article-anchor" href="#getRegister" aria-hidden="true"></a></h3><p><strong>getRegister</strong>(<code>key</code>: string): <em>any</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L43">src/context/context.ts:43</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>key</code></td>
<td>string</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em>any</em></p>
<hr>
<h3 id="pop" class="article-heading"><a href="#pop" class="headerlink" title="pop"></a>pop<a class="article-anchor" href="#pop" aria-hidden="true"></a></h3><p><strong>pop</strong>(): <em>undefined | <a href="../interfaces/context_scope_.plainobject.html">PlainObject</a> | <a href="drop_drop_.drop.html">Drop</a>‹›</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L76">src/context/context.ts:76</a></em></p>
<p><strong>Returns:</strong> <em>undefined | <a href="../interfaces/context_scope_.plainobject.html">PlainObject</a> | <a href="drop_drop_.drop.html">Drop</a>‹›</em></p>
<hr>
<h3 id="push" class="article-heading"><a href="#push" class="headerlink" title="push"></a>push<a class="article-anchor" href="#push" aria-hidden="true"></a></h3><p><strong>push</strong>(<code>ctx</code>: object): <em>number</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L73">src/context/context.ts:73</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>ctx</code></td>
<td>object</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em>number</em></p>
<hr>
<h3 id="restoreRegister" class="article-heading"><a href="#restoreRegister" class="headerlink" title="restoreRegister"></a>restoreRegister<a class="article-anchor" href="#restoreRegister" aria-hidden="true"></a></h3><p><strong>restoreRegister</strong>(<code>keyValues</code>: [string, any][]): <em>void</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L52">src/context/context.ts:52</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>keyValues</code></td>
<td>[string, any][]</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em>void</em></p>
<hr>
<h3 id="saveRegister" class="article-heading"><a href="#saveRegister" class="headerlink" title="saveRegister"></a>saveRegister<a class="article-anchor" href="#saveRegister" aria-hidden="true"></a></h3><p><strong>saveRegister</strong>(…<code>keys</code>: string[]): <em>[string, any][]</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L49">src/context/context.ts:49</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>...keys</code></td>
<td>string[]</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em>[string, any][]</em></p>
<hr>
<h3 id="setRegister" class="article-heading"><a href="#setRegister" class="headerlink" title="setRegister"></a>setRegister<a class="article-anchor" href="#setRegister" aria-hidden="true"></a></h3><p><strong>setRegister</strong>(<code>key</code>: string, <code>value</code>: any): <em>any</em></p>
<p><em>Defined in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/blob/master/src/context/context.ts#L46">src/context/context.ts:46</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody><tr>
<td><code>key</code></td>
<td>string</td>
</tr>
<tr>
<td><code>value</code></td>
<td>any</td>
</tr>
</tbody></table>
<p><strong>Returns:</strong> <em>any</em></p>
</div>
<footer class="article-footer">
<time class="article-footer-updated" datetime="2022-04-17T16:44:24.671Z" itemprop="dateModified">Last updated: 2022-04-17</time>
<a href="../classes/liquid_.liquid.html" class="article-footer-next" title="sidebar.api.Liquid"><span>Next</span><i class="icon-chevron-right"></i></a>
</footer>
</div>
</div>
<aside id="article-toc" role="navigation">
<div id="article-toc-inner">
<div id="article-toc-inner-list">
<strong class="sidebar-title">Contents</strong>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Hierarchy"><span class="toc-text">Hierarchy</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Constructors"><span class="toc-text">Constructors</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#constructor-NaN"><span class="toc-text">constructor</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Properties"><span class="toc-text">Properties</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#environments"><span class="toc-text">environments</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#globals"><span class="toc-text">globals</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#opts"><span class="toc-text">opts</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Private-registers"><span class="toc-text">Private registers</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#Type-declaration"><span class="toc-text">Type declaration:</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Private-scopes"><span class="toc-text">Private scopes</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#strictVariables"><span class="toc-text">strictVariables</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#sync"><span class="toc-text">sync</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Methods"><span class="toc-text">Methods</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#bottom"><span class="toc-text">bottom</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Private-findScope"><span class="toc-text">Private findScope</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#get"><span class="toc-text">get</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#getAll"><span class="toc-text">getAll</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#getFromScope"><span class="toc-text">getFromScope</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#getRegister"><span class="toc-text">getRegister</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#pop"><span class="toc-text">pop</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#push"><span class="toc-text">push</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#restoreRegister"><span class="toc-text">restoreRegister</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#saveRegister"><span class="toc-text">saveRegister</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#setRegister"><span class="toc-text">setRegister</span></a></li></ol></li></ol>
</div>
<a href="#" id="article-toc-top">Back to Top</a>
</div>
</aside>
</div>
</article>
</div>
</div>
</div>
<footer id="footer" class="wrapper">
<div class="inner">
<div id="footer-copyright">
&copy; 2022 <a href="https://github.com/harttle/liquidjs/graphs/contributors" rel="external nofollow noreferrer" target="_blank">Harttle</a><br>
Documentation licensed under <a href="http://creativecommons.org/licenses/by/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>.
</div>
<div id="footer-links">
<a href="https://twitter.com/harttleharttle" rel="external nofollow noreferrer" class="footer-link" target="_blank"><i class="icon-twitter"></i></a>
<a href="https://www.patreon.com/harttle" rel="external nofollow noreferrer" class="footer-link" target="_blank"><i class="icon-patreon"></i></a>
<a href="https://opencollective.com/liquidjs" rel="external nofollow noreferrer" class="footer-link" target="_blank"><i class="icon-opencollective"></i></a>
<a href="https://github.com/harttle/liquidjs" rel="external nofollow noreferrer" class="footer-link" target="_blank"><i class="icon-github"></i></a>
</div>
</div>
</footer>
</div>
<div id="mobile-nav-dimmer"></div>
<nav id="mobile-nav">
<div id="mobile-nav-inner">
<ul id="mobile-nav-list">
<a href="../../tutorials/intro-to-liquid.html" class="mobile-nav-link">Tutorials</a><a href="../../tags/overview.html" class="mobile-nav-link">Tags</a><a href="../../filters/overview.html" class="mobile-nav-link">Filters</a><a href="../../playground.html" class="mobile-nav-link">Playground</a><a href="../../api/classes/liquid_.liquid.html" class="mobile-nav-link">API</a>
</ul>
<div class="mobile-sidebar-list">
<strong class="mobile-nav-title">Quick Entry</strong><a href="../classes/liquid_.liquid.html" class="mobile-nav-link">Liquid</a><a href="../interfaces/liquid_options_.liquidoptions.html" class="mobile-nav-link">LiquidOptions</a><a href="../interfaces/fs_fs_.fs.html" class="mobile-nav-link">FS</a><a href="../interfaces/cache_cache_.cache.html" class="mobile-nav-link">Cache</a><strong class="mobile-nav-title">Classes</strong><a href="../classes/drop_blank_drop_.blankdrop.html" class="mobile-nav-link">BlankDrop</a><a href="../classes/context_context_.context.html" class="mobile-nav-link">Context</a><a href="../classes/tokens_delimited_token_.delimitedtoken.html" class="mobile-nav-link">DelimitedToken</a><a href="../classes/drop_drop_.drop.html" class="mobile-nav-link">Drop</a><a href="../classes/drop_empty_drop_.emptydrop.html" class="mobile-nav-link">EmptyDrop</a><a href="../classes/render_expression_.expression.html" class="mobile-nav-link">Expression</a><a href="../classes/tokens_filter_token_.filtertoken.html" class="mobile-nav-link">FilterToken</a><a href="../classes/drop_forloop_drop_.forloopdrop.html" class="mobile-nav-link">ForloopDrop</a><a href="../classes/tokens_html_token_.htmltoken.html" class="mobile-nav-link">HTMLToken</a><a href="../classes/tokens_hash_token_.hashtoken.html" class="mobile-nav-link">HashToken</a><a href="../classes/cache_lru_.lru.html" class="mobile-nav-link">LRU</a><a href="../classes/liquid_.liquid.html" class="mobile-nav-link">Liquid</a><a href="../classes/tokens_literal_token_.literaltoken.html" class="mobile-nav-link">LiteralToken</a><a href="../classes/drop_null_drop_.nulldrop.html" class="mobile-nav-link">NullDrop</a><a href="../classes/tokens_number_token_.numbertoken.html" class="mobile-nav-link">NumberToken</a><a href="../classes/tokens_operator_token_.operatortoken.html" class="mobile-nav-link">OperatorToken</a><a href="../classes/tokens_output_token_.outputtoken.html" class="mobile-nav-link">OutputToken</a><a href="../classes/util_error_.parseerror.html" class="mobile-nav-link">ParseError</a><a href="../classes/parser_parse_stream_.parsestream.html" class="mobile-nav-link">ParseStream</a><a href="../classes/parser_parser_.parser.html" class="mobile-nav-link">Parser</a><a href="../classes/tokens_property_access_token_.propertyaccesstoken.html" class="mobile-nav-link">PropertyaccessToken</a><a href="../classes/tokens_quoted_token_.quotedtoken.html" class="mobile-nav-link">QuotedToken</a><a href="../classes/tokens_range_token_.rangetoken.html" class="mobile-nav-link">RangeToken</a><a href="../classes/render_render_.render.html" class="mobile-nav-link">Render</a><a href="../classes/util_error_.rendererror.html" class="mobile-nav-link">RenderError</a><a href="../classes/drop_tablerowloop_drop_.tablerowloopdrop.html" class="mobile-nav-link">TablerowloopDrop</a><a href="../classes/tokens_tag_token_.tagtoken.html" class="mobile-nav-link">TagToken</a><a href="../classes/tokens_token_.token.html" class="mobile-nav-link">Token</a><a href="../classes/util_error_.tokenizationerror.html" class="mobile-nav-link">TokenizationError</a><a href="../classes/parser_tokenizer_.tokenizer.html" class="mobile-nav-link">Tokenizer</a><a href="../classes/tokens_word_token_.wordtoken.html" class="mobile-nav-link">WordToken</a><strong class="mobile-nav-title">Enums</strong><a href="../enums/context_block_mode_.blockmode.html" class="mobile-nav-link">BlockMode</a><a href="../enums/parser_token_kind_.tokenkind.html" class="mobile-nav-link">TokenKind</a><strong class="mobile-nav-title">Interfaces</strong><a href="../interfaces/cache_cache_.cache.html" class="mobile-nav-link">Cache</a><a href="../interfaces/template_filter_filter_impl_options_.filterimploptions.html" class="mobile-nav-link">FilterImplOptions</a><a href="../interfaces/fs_fs_.fs.html" class="mobile-nav-link">FS</a><a href="../interfaces/liquid_options_.liquidoptions.html" class="mobile-nav-link">LiquidOptions</a><a href="../interfaces/liquid_options_.normalizedfulloptions.html" class="mobile-nav-link">NormalizedFullOptions</a><a href="../interfaces/context_scope_.plainobject.html" class="mobile-nav-link">PlainObject</a><a href="../interfaces/template_tag_tag_impl_options_.tagimploptions.html" class="mobile-nav-link">TagImplOptions</a>
</div>
</div>
<div id="mobile-button-list">
<a href="https://github.com/harttle/liquidjs" class="mobile-nav-link" rel="external" target="_blank"><i class="icon-github"></i></a>
<a href="https://opencollective.com/liquidjs" class="mobile-nav-link" rel="external" target="_blank"><i class="icon-opencollective"></i></a>
<div id="mobile-lang-select-wrap" class="mobile-nav-link">
<label for="mobile-lang-select"><i class="icon-network"></i></label>
<select id="mobile-lang-select" data-canonical="api/classes/context_context_.context.html">
<option value="en" selected>English</option>
<option value="zh-cn">简体中文</option>
</select>
</div>
</div>
</nav>
<script src="../../js/main.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script>
document.getElementById('search-input-wrap').classList.add('on');
docsearch({
apiKey: '01f36cc168657a26a385308b9e721bc6',
indexName: 'liquidjs',
inputSelector: '#search-input',
debug: false
});
</script>
</body>
</html>