Top Banner
Enrico Risa Codemotion
37

Meteor - Codemotion Rome 2015

Jul 15, 2015

Download

Documents

Codemotion
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Meteor - Codemotion Rome 2015

Enrico Risa Codemotion

Page 2: Meteor - Codemotion Rome 2015

Agenda

1. Meteor

2. Polymer

3. Meteor + Polymer ( Demo )

Page 3: Meteor - Codemotion Rome 2015

Who am i?

Lead Enterprise Engineer at Orient Technologies LTD

Hacking the web since 2005

Page 4: Meteor - Codemotion Rome 2015

Who are you?

Page 5: Meteor - Codemotion Rome 2015

What is Meteor?

Meteor is a complete open source platform for building web and mobile apps

in pure JavaScript• Javascript

Isomorphic - Client, Server, Database

• ReactiveBlaze, Database everywhere

• Web, Mobile

• Packages

Page 6: Meteor - Codemotion Rome 2015

7 Principles

One Language

Data on the Wire

Database Everywhere

Latency Compensation

Full-Stack Reactivity

Embrace the Ecosystem

Simplicity = Productivity

Page 7: Meteor - Codemotion Rome 2015

Quick Start!

$ curl https://install.meteor.com/ | sh

Page 8: Meteor - Codemotion Rome 2015

Quick Start!

$ meteor create myapp

$ cd myapp

$ meteor

$ meteor deploy myapp.meteor.com

Page 9: Meteor - Codemotion Rome 2015

App Structure

/client

/server

/public

/lib

/tests

Page 10: Meteor - Codemotion Rome 2015

Components

LiveQuery - Live Database Connectors - Realtime database queries.

DDP - Distributed Data Protocol -Subscribe to changes in the database.

Mini Databases - Database in memory Javascript (MiniMongo) - Run database queries in the client

Tracker - Reactive Programming -Rerun functions when data changes

Blaze-Keep the view up-to-date with your data

Session-A library to handle reactive UI state variables

Page 11: Meteor - Codemotion Rome 2015

Template

Spacebars (Handlebars inspired)

Page 12: Meteor - Codemotion Rome 2015

Template Helpers

Helpers are simply Javascript methods that you make available to template

Page 13: Meteor - Codemotion Rome 2015

Template Events

Register events to elements in a particular template

Page 14: Meteor - Codemotion Rome 2015

Meteor Collections

Simple to defineTodos = new Mongo.Collection(‘todos’);

Collections.[insert | update | remove] available client/server side.

Page 15: Meteor - Codemotion Rome 2015

Meteor Subscriptions

Remove “autopublish” & “insecure”

Server Side

Client Side Meteor.subscribe('todos')

Page 16: Meteor - Codemotion Rome 2015

Meteor Methods

Server Side

Client Side

Client/Server Communication

Page 17: Meteor - Codemotion Rome 2015

Packages

Routing (Iron Route)

UI (Bootstrap3/Foundation)

Mail

Accounts

Security

….

https://atmospherejs.com

meteor add package

Page 18: Meteor - Codemotion Rome 2015

Iron Route

Client and Server side router

MVC

Controllers

Data

Subscriptions

http://manuel-schoebel.com/blog/iron-router-tutorial

Page 19: Meteor - Codemotion Rome 2015

Built with Meteor

Page 20: Meteor - Codemotion Rome 2015

Meteor Numbers

Over 200 meetup groups around the worldhttp://meteor.meetup.com

Over 4500 packages publishedhttps://atmospherejs.com

Ranked #11 on GitHub

Raised $11m in 2012

Page 21: Meteor - Codemotion Rome 2015

What is Polymer?

A library built on top of Web Components and enable developers to create reusable elements for the web

Let us use Web Components today in modern browser

Composed By- A set of polyfills- Web application framework- Set of UI components (Material Design)

Page 22: Meteor - Codemotion Rome 2015

Web Components

Custom Elements

Shadow DOM

Templates

HTML imports

W3C Standard

http://www.w3.org/TR/components-intro

Page 23: Meteor - Codemotion Rome 2015

Custom Elements

create new HTML/DOM elements

declarative HTML

Page 24: Meteor - Codemotion Rome 2015

Shadow DOM

DOM/CSS/JS Encapsulation

Shadow DOM separates content from presentation thereby eliminating naming conflicts and improving code expression

Page 25: Meteor - Codemotion Rome 2015

Templates

Native templating in the browser

Polymer implements data-binding

Page 26: Meteor - Codemotion Rome 2015

HTML imports

Loading and dependency management

Find existing elements

Import and just use it

<link rel="import" href="/bower_components/paper-input/paper-input.html">

Page 27: Meteor - Codemotion Rome 2015

How do I use Polymer?

Using Elements- Polymer Elements (Core/Paper)- Community Elements

Creating Elements

Page 28: Meteor - Codemotion Rome 2015

Core/Paper Elements

Polymer's core elements are a set of visual and non-visual utility elements.

Polymer's paper elements collection implements material design for the web.

polymer-project.org/0.5/docs/elements

Page 29: Meteor - Codemotion Rome 2015

Using Elements

http://customelements.io

https://googlewebcomponents.github.io

http://component.kitchen

<lastfm-card user="maggiolo00"></lastfm-card>

Page 30: Meteor - Codemotion Rome 2015

Create your own elements

Page 31: Meteor - Codemotion Rome 2015

Vulcanize

Process Web Components in a single file

Map your components in “imports.html” to <head></head>

Useful in production

Page 32: Meteor - Codemotion Rome 2015

Meteor + Polymer = <3

Great Result

Easy to use Both within an app

Polymer elements emit events like normal DOM elements

Polymer for Web Components and Material Design

Meteor for data synch, realtime and rendering

Example app- polymer-demo- usercycle

Page 33: Meteor - Codemotion Rome 2015

Integration Concern

Still experimental

Lack of resources

Polymer bleeding edge < 1.0

Web Components not fully supported( are-we-componentized-yet )

Native support (Chrome only)

Page 34: Meteor - Codemotion Rome 2015

{{< demo}}

Page 35: Meteor - Codemotion Rome 2015

Resources

http://blog.differential.com/meteor-polymer

http://grigio.org/polymer_and_meteorjs_holy_grail_web_development

http://blog.usercycle.com/why-meteor-and-polymer/

Page 36: Meteor - Codemotion Rome 2015

Live in Rome?

http://www.meetup.com/Meteor-Rome/

Page 37: Meteor - Codemotion Rome 2015

<thanks> Questions?

</thanks>

Enrico Risa @wolf4ood