jQuery的Command模式插件 command.js

码农软件 · 软件分类 · 其他(Others) · 2019-07-20 23:42:08

软件介绍

基于jQuery的Command模式插件。

该插件将页面元素看成是一个个的对象,通过插件给对象赋予特定的状态,并定义特定的Command。一旦发生关联操作的时候,可以通过通知修改状态或者发布命令的方式进行关联操作。

例如:

$(function(){
        $(".a").commands({
            states : [{
                state : "selected",
                paint : function($elem,state){
                    console.log(state);
                },
                drop : function($elem,state) {
                    console.log("drop:" + state);
                }
            },{
                state : "unselected",
                paint : function($elem,state){
                    console.log(state);
                },
                drop : function($elem,state) {
                    console.log("drop:" + state);
                }
            }],
            commands : [{
                name : "select",
                action : function($elem,state){
                    $elem.state("selected");
                }
            }]
        });

        $(".a").state("unselected");
        $(".a").command("select");
        console.log($(".a").currentState());
    });

本文地址:https://codercto.com/soft/d/10587.html

The Little Schemer - 4th Edition

The Little Schemer - 4th Edition

Daniel P. Friedman、Matthias Felleisen / The MIT Press / 1995-12-21 / USD 40.00

This delightful book leads you through the basic elements of programming in Scheme (a Lisp dialect) via a series of dialogues with well-chosen questions and exercises. Besides teaching Scheme, The Lit......一起来看看 《The Little Schemer - 4th Edition》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具