Reactive Coffee轻量级的 CoffeeScript 库
Reactive Coffee 是轻量级的 CoffeeScript 库/DSL,为响应式编程和声明式构建可扩展 web UIs 提供帮助。
示例:
# This is our core data model, an array of Task objects.class Task constructor: (descrip, priority, isDone) -> @descrip = rx.cell(descrip) @priority = rx.cell(priority) @isDone = rx.cell(isDone)tasks = rx.array([ new Task('Get milk', 'important', false) new Task('Play with Reactive Coffee', 'critical', false) new Task('Walk the dog', 'meh', false)])# Our main view: a checklist of tasks, a button to add a new task, and a task# editor component (defined further down).main = -> currentTask = rx.cell(tasks.at(0)) # "View model" of currently selected task $('body').append( div {class: 'task-manager'}, [ h1 {}, bind -> ["#{tasks.length()} task(s) for today"] ul {class: 'tasks'}, tasks.map (task) -> li {class: 'task'}, [ input {type: 'checkbox', init: -> @change => task.isDone.set(@is(':checked'))} span {class: 'descrip'}, bind -> [ "#{task.descrip.get()} (#{task.priority.get()})" ] a {href: 'javascript: void 0', init: -> @click => currentTask.set(task)}, [ 'Edit' ] ] button {init: -> @click => tasks.push(new Task('Task', 'none', false))}, [ 'Add new task' ] taskEditor { task: bind -> currentTask.get() onSubmit: (descrip, priority) -> currentTask.get().descrip.set(descrip) currentTask.get().priority.set(priority) } ] )# The task editor demonstrates how to define a simple component.taskEditor = (opts) -> task = -> opts.task.get() theForm = form {}, [ h2 {}, ['Edit Task'] label {}, ['Description'] descrip = input {type: 'text', value: bind -> task().descrip.get()} br {} label {}, ['Priority'] priority = input {type: 'text', value: bind -> task().priority.get()} br {} label {}, ['Status'] span {}, bind -> [if task().isDone.get() then 'Done' else 'Not done'] br {} button {}, ['Update'] ] theForm.submit -> opts.onSubmit(descrip.val().trim(), priority.val().trim()) @reset() false$(main)
评论
Reactor.js实现 reactive programming 的 JavaScript 库
Reactor是一个轻量级的实现reactiveprogramming的JavaScript库。提供Reactive变量可在依赖的变化下自动更新值。类似电子表格中的计算单元,其他相关的单元格数据更改后
Reactor.js实现 reactive programming 的 JavaScript 库
0
Reactor.js实现 reactive programming 的 JavaScript 库
Reactor 是一个轻量级的实现 reactive programming 的 JavaScrip
Reactor.js实现 reactive programming 的 JavaScript 库
0
ZRender轻量级的图形库
ZRender是一个轻量级的图形库,可为ApacheECharts提供2d绘制。ZRender 是二维绘图引擎,它提供Canvas、SVG、VML等多种渲染方式。ZRender也是 ECharts 的
ZRender轻量级的图形库
0
Neact轻量级的 vdom 库
neact是一个轻量级的vdom库,兼容React的api,支持IE8。建议作为解决局部view的更新,以及独立组件开发,因为neact很小。
Neact轻量级的 vdom 库
0
Idiorm轻量级的ORM库
Idiorm是一款轻量级的ORM库,建立在PDO之上的PHP5查询构造器。示例代码:$user = ORM::for_table('user') ->where_equal('userna
Idiorm轻量级的ORM库
0