<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Storing dict outside of visual.ts in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1130435#M23948</link>
    <description>&lt;P&gt;Glad to hear it's working for you, and thanks for the feedback on the file extension - I'll update the answer with the correct info &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 30 May 2020 05:23:00 GMT</pubDate>
    <dc:creator>dm-p</dc:creator>
    <dc:date>2020-05-30T05:23:00Z</dc:date>
    <item>
      <title>Storing dict outside of visual.ts</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1125284#M23912</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have encoded a heap of images as base64 and stored them in a dict, currently, it is making a mess in my visual.ts file, it's super long. Is there any way I can store these in another file and call the variable when needed? I have been banging my head against the wall for a while.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dict.PNG" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/284002i8277DA9B15E95479/image-size/large?v=v2&amp;amp;px=999" role="button" title="dict.PNG" alt="dict.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 07:17:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1125284#M23912</guid>
      <dc:creator>BrentonC</dc:creator>
      <dc:date>2020-05-28T07:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Storing dict outside of visual.ts</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1127588#M23936</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/225725"&gt;@BrentonC&lt;/a&gt;,&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a file in the relative folder to your &lt;FONT face="courier new,courier"&gt;visual.ts&lt;/FONT&gt;, e.g. &lt;FONT face="courier new,courier"&gt;constants.ts.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;Cut/paste your &lt;FONT face="courier new,courier"&gt;dict&lt;/FONT&gt; declaration into this file.&lt;/LI&gt;
&lt;LI&gt;Change &lt;FONT color="#333399"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;private dict&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt; to &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#333399"&gt;export const dict&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;In your &lt;FONT face="courier new,courier"&gt;visual.ts&lt;/FONT&gt;, at the top, add &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#333399"&gt;import { dict } from './constants';&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#808080"&gt;(edited for correctness)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;You can then access the object as &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#333399"&gt;dict &lt;/FONT&gt;&lt;/STRONG&gt;anywhere in the visual.ts code (so you may need to remove '&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#333399"&gt;this.&lt;/FONT&gt;&lt;/STRONG&gt;' from any instances if you've done that, as it's no longer a property of your Visual class.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Note that you don't have to use these exact names, just make sure everything links together, e.g. the constant name and the file it's sourced from.&lt;/P&gt;
&lt;P&gt;Also, the &lt;FONT face="courier new,courier"&gt;export&lt;/FONT&gt; in front of your &lt;FONT face="courier new,courier"&gt;const&lt;/FONT&gt; declaration in step 3 is very important, otherwise it's not 'visible' to other files when you try to &lt;FONT face="courier new,courier"&gt;import&lt;/FONT&gt; it.&lt;/P&gt;
&lt;P&gt;If you want to see a pre-canned example within your project (assuming you started with a blank visual), your &lt;FONT face="courier new,courier"&gt;settings.ts&lt;/FONT&gt; does the same thing with the &lt;FONT face="courier new,courier"&gt;VisualSettings&lt;/FONT&gt; class declaration, and its subsequent import into &lt;FONT face="courier new,courier"&gt;visual.ts&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://javascript.info/import-export" target="_self"&gt;Here's some further reading on ES6 imports and exports&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 05:24:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1127588#M23936</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2020-05-30T05:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Storing dict outside of visual.ts</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1130070#M23947</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva" color="#000000"&gt;Thank you, it did have an issue with me trying to import&amp;nbsp;'./constants.ts' as it did not want the extension on there so&amp;nbsp;'./constants' did the job. I am not very familiar with javascript/node.js, best I do some reading up on it and learn the fundamentals. Thank you for the good explanation.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" color="#000000"&gt;Brenton Collins&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 19:22:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1130070#M23947</guid>
      <dc:creator>BrentonC</dc:creator>
      <dc:date>2020-05-29T19:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Storing dict outside of visual.ts</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1130435#M23948</link>
      <description>&lt;P&gt;Glad to hear it's working for you, and thanks for the feedback on the file extension - I'll update the answer with the correct info &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 05:23:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Storing-dict-outside-of-visual-ts/m-p/1130435#M23948</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2020-05-30T05:23:00Z</dc:date>
    </item>
  </channel>
</rss>

