javascript es6 modules
16 posts
• Page 2 of 2 • 1, 2
Re: javascript es6 modules
Michael
Your code worked on chrome for me.
In addition
Your ThreePage.dyalog code was very instructive. It showed me the syntax
for:
1) how to use type=importmap with _.script ScriptFollows
2) how to use type=module with _.script
It also showed
3) how to capture info in a Page's or Template's public field
4) how to construct a script on the fly and add it to the Head
I noticed that:
When referencing a template in a page, I believe
that if I use #.ThreePage DUI looks in ServerRoot/Core
and if I use just ThreePage, DUI looks in SiteRoot/Code/Templates
Bryant
Your code worked on chrome for me.
In addition
Your ThreePage.dyalog code was very instructive. It showed me the syntax
for:
1) how to use type=importmap with _.script ScriptFollows
2) how to use type=module with _.script
It also showed
3) how to capture info in a Page's or Template's public field
4) how to construct a script on the fly and add it to the Head
I noticed that:
When referencing a template in a page, I believe
that if I use #.ThreePage DUI looks in ServerRoot/Core
and if I use just ThreePage, DUI looks in SiteRoot/Code/Templates
Bryant
- bry
- Posts: 8
- Joined: Wed Oct 11, 2017 6:16 pm
Re: javascript es6 modules
Bryant,
it's good news to see that this example served its purpose.
WRT loading, your assumptions are partially correct. Let's look in more detail at the process:
Also, if you end up writing tools that you need to use on > 1 .mipage, you don't have to duplicate that code in every page, just put it into the /app/Code folder. You can use .dyalog files that contain namespaces, classes or even simple fns.
I hope this helps for the next steps...
Michael
it's good news to see that this example served its purpose.
WRT loading, your assumptions are partially correct. Let's look in more detail at the process:
- at startup, DUI loads code from disc into the workspace. Some bits that are relevant for us:
- /DUI/Core goes into #
- /app/Code goes into #
- /app/Code/Templates goes into
#.Pages
- when the browser asks for a file: DUI checks if that file is a .mipage. If it is and if it is found in #.Pages (and has the file has the same timestamp as it had when we loaded it last time), that instance is called. If it does not exist, has a newer timestamp or a different extension, DUI searches the app folder. (BTW, you can also have a folder structure on disc that the URLs need to mirror, i.e. /a/b/c/foo.mipage asks for /app/a/b/c/foo.mipage).
- when such a .mipage is instantiated, the interpreter requires that its base class exists - otherwise it throws an error. The base class will exist if it exists in /app/Code/Templates (and thus was loaded at startup). If you refer to a class in #, it may have been loaded at startup from several possible locations - but it is recommended practice to keep the templates in their folder.
Also, if you end up writing tools that you need to use on > 1 .mipage, you don't have to duplicate that code in every page, just put it into the /app/Code folder. You can use .dyalog files that contain namespaces, classes or even simple fns.
I hope this helps for the next steps...
Michael
- Michael|Dyalog
- Posts: 23
- Joined: Thu Mar 02, 2017 4:29 pm
Re: javascript es6 modules
Hi Michael
I am having another basic problem with DUI/MiServer.
I build a page with buttons; in a callback I clone
the selected button; then I try to append the cloned
button to an existing div. The cloned button appears
for a brief second and then disappears. I assume that
MiServer/DUI is reloading the entire page. I used APLJax
in the code and it still happens. What am I missing
about how pages are refreshed?
Thanks in advance
Bryant
I am having another basic problem with DUI/MiServer.
I build a page with buttons; in a callback I clone
the selected button; then I try to append the cloned
button to an existing div. The cloned button appears
for a brief second and then disappears. I assume that
MiServer/DUI is reloading the entire page. I used APLJax
in the code and it still happens. What am I missing
about how pages are refreshed?
Thanks in advance
Bryant
- bry
- Posts: 8
- Joined: Wed Oct 11, 2017 6:16 pm
Re: javascript es6 modules
Hi Bryant,
usually a callback does not trigger a reload of the page, so something must be going wrong somewhere - but it's impossible to say w/o seeing the code.
Feel free to email me {ForumHandle}@dyalog.com) - it would be great if you could zip the whole MiSite...
(Confidentiality will be kept, but we can discuss formal NDA as well, if neccessary)
Thanka
Michael
usually a callback does not trigger a reload of the page, so something must be going wrong somewhere - but it's impossible to say w/o seeing the code.
Feel free to email me {ForumHandle}@dyalog.com) - it would be great if you could zip the whole MiSite...
(Confidentiality will be kept, but we can discuss formal NDA as well, if neccessary)
Thanka
Michael
- Michael|Dyalog
- Posts: 23
- Joined: Thu Mar 02, 2017 4:29 pm
Re: javascript es6 modules
Hi Bryant,
I thought I should add that when Michael gives his email address as forum handle that that is his name without the "|Dyalog" part of the forum handle text.
Regards,
Vince
I thought I should add that when Michael gives his email address as forum handle that that is his name without the "|Dyalog" part of the forum handle text.
Regards,
Vince
- Vince|Dyalog
- Posts: 433
- Joined: Wed Oct 01, 2008 9:39 am
Re: javascript es6 modules
Thanks Vince. That as my first guess, but when I tried it, it bounced.
Michael has since sent me email so I have his address.
Bryant
Michael has since sent me email so I have his address.
Bryant
- bry
- Posts: 8
- Joined: Wed Oct 11, 2017 6:16 pm
16 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 0 guests
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group