What if we wanted to use backbone-style event delegation within the component paradigm afforded by react/preact/etc? Would that be useful?
Basic usage:
var namespace = 'mediacat' | |
function cx(classNames, options) { | |
var classes; | |
var states; | |
var bemClasses = []; | |
var baseClassName; | |
var stateClassName; | |
if (typeof classNames == 'object') { |
function await(generatorFunction) { | |
let gen = generatorFunction(); | |
/** | |
* @param {any?} err The error to throw in the generator, where yield was last called. | |
* @param {any?} result The result to pass to the genarator for the last call to yield | |
*/ | |
function next(err, result) { | |
// If the last promise that was yielded was rejected, | |
// trigger an error inside the generator where yield was last called |
import React from 'react'; | |
import { createContainer, graphql } from '../../../Relux'; | |
class EventDetail extends React.Component { | |
render() { | |
const { event } = this.props; | |
if (event) { |
<?php | |
class ImageProxy { | |
function __construct($request) { | |
$this->sourceFolder = "/wp-content/uploads/"; | |
$this->path = dirname($request); | |
$this->partialFileName = str_replace($this->path."/", "", $request); |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
if (/iPhone|iPod|iPad/.test(navigator.userAgent)) | |
$('iframe').wrap(function(){ | |
var $this = $(this); | |
return $('<div />').css({ | |
width: $this.attr('width'), | |
height: $this.attr('height'), | |
overflow: 'auto', |
h('div.container', [ | |
h('label.nameLabel', 'Name:'), | |
h('input.myinput', {attributes: {type: 'text'}}), | |
h('hr'), | |
h('h1.greeting', `Hello ${name}`) | |
]) | |
// or | |
div('.container', [ |
// JSLitmus.js | |
// | |
// Copyright (c) 2010, Robert Kieffer, http://broofa.com | |
// Available under MIT license (http://en.wikipedia.org/wiki/MIT_License) | |
(function() { | |
// Private methods and state | |
// Get platform info but don't go crazy trying to recognize everything | |
// that's out there. This is just for the major platforms and OSes. |
Router.map(function () { | |
this.route('index', { | |
controller: 'BasicController', | |
layoutTemplate: 'indexLayout', | |
path: '/', | |
waitOn: function () { | |
return Meteor.subscribe('Channels'); | |
} | |
}); |
<!-- Context should be the object you are tagging --> | |
<template name="tagInput"> | |
<select class='tag-input' name='tags[]' multiple="multiple"> | |
{{#each tags}} | |
<option value="{{this}}" selected="true">{{this}}</option> | |
{{/each}} | |
</select> | |
</template> |