zoukankan      html  css  js  c++  java
  • 解决react和其他框架之间的交互问题

    import EventEmitter from 'eventemitter3';

     拓展

    1.只触发一次

    EventEmitter.prototype.once = function(events,handler){
        // no events,get out!
        if(! events)
            return; 
     
        // Ugly,but helps getting the rest of the function 
        // short and simple to the eye ... I guess...
        if(!(events instanceof Array))
            events = [events];
     
        var _this = this;
     
        var cb = function(){
            events.forEach(function(e){     
                // This only removes the listener itself 
                // from all the events that are listening to it
                // i.e.,does not remove other listeners to the same event!
                _this.removeListener(e,cb); 
            });
     
            // This will allow any args you put in xxx.emit('event',...) to be sent 
            // to your handler
            handler.apply(_this,Array.prototype.slice.call(arguments,0));
        };
     
        events.forEach(function(e){ 
            _this.addListener(e,cb);
        }); 
    };

      

  • 相关阅读:
    DNS收集分析之host
    DNS收集分析fierce
    DNS收集分析dig
    DNS收集分析reverseraider
    DNS收集分析lbd
    DNS收集查询dnsrecon
    DNS收集分析dnsmap
    Preclassify
    OSPF Forwarding Address 引起的环路
    kali笔记
  • 原文地址:https://www.cnblogs.com/it-Ren/p/13810252.html
Copyright © 2011-2022 走看看