Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do Meteor's blaze and Famo.us play together?

2 Technologies:

  • Meteor with the blaze templating engine
  • Famo.us with their awesome gui framework

I come from the meteor side, I personally like using {{mustache}} (handlebars) to drive the gui from data, the reactive session / database makes this really efficient and intuitive.

Now came famo.us and all its advantages, but the drawback of a code based gui is that there is no place for handlebars anymore…

  • What is the current practice for mixing both technologies together ?
  • Are they completely dissociative ?
  • Is using the "observe" / "Deps.autorun" mechanism a common practice everywhere a famo.us element to be updated by a meteor reactive item ?
like image 687
Flavien Volken Avatar asked Apr 15 '14 12:04

Flavien Volken


People also ask

What do asteroid and comet have in common?

Asteroids and comets have a few things in common. They are both celestial bodies orbiting our Sun, and they both can have unusual orbits, sometimes straying close to Earth or the other planets. They are both “leftovers” — made from materials from the formation of our Solar System 4.5 billion years ago.

What is the connection of meteor showers named to the stars?

Meteor showers are usually named after a star or constellation that is close to where the meteors appear in the sky. Perhaps the most famous are the Perseids, which peak in August every year. Every Perseid meteor is a tiny piece of the comet Swift-Tuttle, which swings by the Sun every 135 years.

What is difference between meteor and meteorites?

What Is a Meteor? Meteors are not meteorites. Like meteorites, meteors are objects that enter Earth's atmosphere from space. But meteors—which are typically pieces of comet dust no larger than a grain of rice—burn up before reaching the ground.

Which of the following is the fastest meteors?

The Leonids are bright meteors and can also be colorful. They are also fast: Leonids travel at speeds of 44 miles (71 kilometers) per second, and they are considered to be some of the fastest meteors.


1 Answers

I just released a preview of famous-components, which is an attempt at a tight integration between Blaze and Famous. All the other approaches I've seen so far side step most of Blaze, and require writing large amounts of code in JavaScript, which felt very unnatural to me in Meteor. Meteor code should be small, concise and easy with powerful results. Here are a few examples of what it looks like: (each template forms a renderNode, any HTML gets put on a Surface. Modifiers/views/options are specified as a component attributes)

<template name="test">
  {{#Surface size=reactiveSizeHelper}}
    <p>hello there</p>
  {{/Surface}}

  {{#if loggedIn}}
    {{>SequentialLayout template='userBar' direction="X"}}
  {{else}}
    {{>Surface template='pleaseLogIn' origin="[0.5,0.5]"}}
  {{/if}}
</template>

Scrollview (can be split into sub templates):

<template name="famousInit">
  {{#Scrollview size="[undefined,undefined]"}}
    {{#famousEach items}}
      {{#Surface size="[undefined,100]"}}{{name}}{{/Surface}}
    {{/famousEach}}
  {{/Scrollview}}
</template>

Template.famousInit.items = function() { return Items.find() };

Events:

Template.blockSpring.events({
  'click': function(event, tpl) {
    var fview = FView.fromTemplate(tpl);
    fview.modifier.setTransform(
      Transform.translate(Math.random()*500,Math.random()*300),
      springTransition
    );
  }
});

It also works out the box with iron-router. More details, docs, live demos, all at http://famous-views.meteor.com/

like image 196
gadicc Avatar answered Oct 22 '22 09:10

gadicc