İşte, Şubat 2014 Devshop'tan Meteor with Famous'u tümleştirme hakkında bir sunum. Bunu iki ay içinde görmedim, ama onları hatırlıyorum. Bunları hatırlıyorum. evet, Collection.observe modelini kullanıyorsunuz.
Kısacası
, sadece veya Three.js Tepki kullanmak gibi, Ünlü Blaze şablon motoruna geniş olduğunu. Tamamen tersine çevirir ve tüm öğeleri düz DOM olarak işler. Oku Mark's answer about this.
require.js API'sini kullanan bir paket, birkaç gün önce Atmosfer'e gönderildi. Buna Famono denir.
observe
ile minimalist bir kavram kanıtı oluşturmak için kullandım. source code on Github ve ayrıca deployed it with meteor deploy'u da bulabilirsiniz.
Kodun kendisi gerçekten çok basit. Koleksiyonu:
// server/fixtures.js
if (Clicks.find().count() === 0) {
Clicks.insert({ 'number': 0 });
}
Ve index.js
dosyası: sunucu üzerinde küçük bir fikstür bir öğe eklemek için
// collections/clicks.js
Clicks = new Meteor.Collection('clicks');
// client/index.js
UI.body.rendered = function() {
require("famous-polyfills"); // Add polyfills
require("famous/core/famous"); // Add the default css file
var Engine = require('famous/core/Engine');
var Surface = require('famous/core/Surface');
var Modifier = require('famous/core/Modifier');
var mainContext = Engine.createContext();
var containerModifier = new Modifier({
origin: [0.5, 0.5]
});
mainContext = mainContext.add(containerModifier);
var square = new Surface({
size: [200, 200],
properties: {
lineHeight: '200px',
textAlign: 'center',
background: 'rgba(200, 200, 200, 0.5)'
}
});
Clicks.find().observe({
added: function(clickCounter) {
// This is the way that you replace content in your surface.
// Injecting handlebars templates here will probably do nothing.
square.setContent(clickCounter.number);
},
changed: function(clickCounter) {
square.setContent(clickCounter.number);
}
});
square.on('click', function() {
// Hardcoded to work with only the first item in the collection.
// Like I said, minimal proof of concept.
var clickCounter = Clicks.findOne();
Clicks.update(clickCounter._id, { number: clickCounter.number + 1 });
});
mainContext.add(square);
};
@gadicc Sadece meteor özetinde yazınızı gördüm, daha fazla katkıda bulunanları bekleyen, kesin bir cevap için hala erken gibi görünüyor. –
yorumumu sildi. Kod şu anda herkese açık olduğundan, bir Yanıt olarak gönderdim. İnsanların ne ile yaklaştığını görmek ne mutlu. – gadicc