doc-exports/docs/fg/umn/functiongraph_03_0882.html
Chen, Junjie dac566cf2f FG UMN 20230725 version
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: Chen, Junjie <chenjunjie@huawei.com>
Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
2024-04-03 10:30:56 +00:00

28 lines
1.3 KiB
HTML

<a name="functiongraph_03_0882"></a><a name="functiongraph_03_0882"></a>
<h1 class="topictitle1">Do You Have Sample Code for Initializers?</h1>
<div id="body0000001518896573"><p id="functiongraph_03_0882__p8060118">Yes. See the following examples:</p>
<ul id="functiongraph_03_0882__ul65691191561"><li id="functiongraph_03_0882__li10570139767">Node.js<pre class="screen" id="functiongraph_03_0882__screen2034214461276">exports.initializer = function(context, callback) {
callback(null, '');
};</pre>
</li><li id="functiongraph_03_0882__li12361326617">Python<pre class="screen" id="functiongraph_03_0882__screen10926105317714">def my_initializer(context):
print("hello world!")</pre>
</li><li id="functiongraph_03_0882__li114531505620">Java<pre class="screen" id="functiongraph_03_0882__screen11468591594">public void my_initializer(Context context)
{
RuntimeLogger log = context.getLogger();
log.log(String.format("ak:%s", context.getAccessKey()));
}</pre>
</li><li id="functiongraph_03_0882__li74173551762">PHP<pre class="screen" id="functiongraph_03_0882__screen133712185118">&lt;?php
Function my_initializer($context) {
echo 'hello world' . PHP_EOL;
}
?&gt;</pre>
</li></ul>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="functiongraph_03_0110_00.html">General FAQs</a></div>
</div>
</div>