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.

My only pain point is having to use foo.set() and foo.callMethod() to set properties or call methods.

Can .set() be replaced with accessors, and callMethod() with actual method calls? That’s pretty much the major difference on the API side compared to Vue.

This is a bunch of extra verbosity that I’d like to avoid.

The speed compared to Vue is really nice. What is fundamentally different about it compared to Vue on the internals that makes Moon faster?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
sudomabidercommented, Sep 5, 2017

I’ve just finished a small plugin with Moon to be embedded in all our clients. Knowing Vue already it was super easy to pick up Moon. And being as lightweight as it is, the plugin turns out to be awesomely small in size. I feel this is exactly where Moon shines (pardon the pun). And I mostly quite like the current state of its API. We really don’t need yet another full blown framework in my opinion 😄

To be clear, I’m all for making things simpler and easier to use. But please don’t let v1 get too much bigger 😅

2reactions
kbrshcommented, Sep 4, 2017

Thanks @trusktr!

I’ll definitely try to make the method API simpler. As for the inline expressions–they won’t be supported inside of m-on, but they will be supported in v1.

In fact, they are supported in v0.11.0 if you add parenthesis around the expression:

{{ (toggle ? 'On' : 'Off') }}
{{ (value || 'Default') }}

In v1 this will be done for you. For now, you can use a plugin for a simple method API.

const MoonMethods = {
  init(Moon) {
    const MoonInit = Moon.prototype.init;
    Moon.prototype.init = function() {
      const methods = this.$options.methods;
      if(methods !== undefined) {
        for(let name in methods) {
          this[name] = methods[name];
        }
      }
      MoonInit.call(this);
    }
  }
};

Moon.use(MoonMethods);

const app = new Moon({
  methods: {
    foo() {
      alert("Foo Called!");
    }
  }
});

app.foo();

One thing I’m trying to prevent with Moon is too many ways to accomplish a single thing (like in Vue). It’s to make it a little easier to approach and maintain. It’s similar to Ractive’s API (but Ractive is like 10 times larger).

Read more comments on GitHub >

github_iconTop Results From Across the Web

I Love It feat. Adele Givens [Official Music Video] - YouTube
Watch the official music video for I Love It by Kanye West & Lil Pump feat. Adele Givens from the album Harverd Dropout....
Read more >
Icona Pop - I Love It (ft. Charli XCX) [Lyrics] - YouTube
Icona Pop - I Love It (ft. Charli XCX) (Lyrics)Subscribe and press ( ) to join the Notification Squad and stay updated...
Read more >
Icona Pop - I Love It (Feat. Charli XCX) [Audio] - YouTube
Icona Pop - I Love It (Feat. Charli XCX)2013 Artist Company TEN, under exclusive License to Universal Music ABFind it on iTunes: ...
Read more >
Kylie Minogue - I Love It (Official Audio) - YouTube
The Official Audio for I Love It by Kylie Minogue. DISCO: Guest List Edition is out now.
Read more >
I Love It (Icona Pop song) - Wikipedia
"I Love It" is a song by Swedish duo Icona Pop featuring vocals from British recording artist Charli XCX. It was released as...
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