On Github jede / your-perfect-js-framework
Mål: Blixtsnabb bild - var är JS-världen på väg
var compiled = _.template("hello: <%= name %>"); compiled({name: 'moe'}); // => "hello: moe"
@Component({ selector: 'my-hero-detail', }) export class HeroDetailComponent { }
<my-hero-detail></my-hero-detail>
<p>Hello {{name}}</p> <input value={{name}}>
Router.map(function() { this.route('about'); this.route('favorites', { path: '/favs' }); });
var CommentBox = React.createClass({ render: function() { return ( <div className="commentBox"> Hello, world! I am a CommentBox. </div> ); } }); ReactDOM.render( <CommentBox />, document.getElementById('content') );
Template.task.events({ 'click .toggle-checked'() { Tasks.update(this._id, { $set: { checked: ! this.checked }, }); } });
<template id="product"> <div> <span class="name"></span> </div> </template>
<p id="hostElement"></p>
var shadow = document.querySelector('#hostElement').createShadowRoot(); shadow.innerHTML = '<p>Here is some new text</p>';
class SaveBtn extends HTMLElement { constructor() { super(); } // Define the required of the 4 available callbacks // Define getters and setters } document.registerElement("save-button", SaveBtn);
<save-button></save-button>
<head> <link rel="import" href="bootstrap.html"> </head>
// content.js module.exports = "Hello from content.js.";
// index.js document.write(require("./content.js")); // Prints: Hello from content.js