question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

awesome build-less moon (+lazy load components?)

See original GitHub issue

Awesome project! I was amazed how fast I could just get an index.html up and running, without having to install any transpiler (babel/webpack etc).

Question: what would you think of promise-support or url-support for the ‘view’-property?

So instead of

            Moon({
                root: "#root",
                view: $('#view').innerHTML,
                ....

It would support:

            Moon({
                root: "#root",
                view: Moon.component('view/myview.html') // moon evaluates promise
                ...

example (pseudocode):

Moon.component = (url) => {
    return new Promise( (resolve,reject) => {
        fetch(url)
        .then( (d) => d.text() )
        .then( resolve )
        .catch(reject)
    })
}

Why?

Many times i need to livecode HTML. Having the scalability of single-file-components, and not having to use the cli really speeds up the production i my case. Moon is so incredibly simple & easy to use, it kind of makes it sexy to not need an extra buildstep for single-file-components (like vue).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kbrshcommented, Jul 1, 2019

Glad to hear @coderofsalvation @LeviSchuck!

I’ve tried it out on some small components and experiments, and you’re right haha — it’s very curryable and it’s super easy to create higher-order functions. Even though I created the new design, I haven’t explored its full potential.

I just committed the changes in 265252ed8145ffc75c227ca3232ce1b0074fcfbc, definitely one of my larger commits. Feel free to hop on the Slack and I can help you all try it out 😃

0reactions
kbrshcommented, Aug 9, 2019

Moon v1 beta 3 is out! 🎉

Let me know what you think — I’m closing this for now because I think it can be achieved through Promises and returning an intermediate loading state inside a component function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Lazy Loading: The Best Complete Guide - CopyCat Blog
Learn how to optimize your app with a complete guide to React lazy loading and code splitting with coding examples, tips, videos, and...
Read more >
Lazy loading React components - LogRocket Blog
Lazy loading enables you to render elements on demand, making your app more efficient and improving the user experience. How to use lazy...
Read more >
Lazy load Angular components - Medium
Lazy loading so far — Lazy loaded routes. Lazy loading is a great feature. In Angular, we get it almost for free by...
Read more >
Lazy Loading Individual Vue Components and Prefetching
In this article, we will explore which types of components can be loaded lazily and, more importantly, how to handle the waiting required ......
Read more >
Does Angular Lazy Loading increase build time?
I just started in a project in Angular 12 where almost all components are in small modules that are lazy loaded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found