SHARE
    TWEET
    Guest User

    Untitled

    a guest
    Sep 7th, 2014
    1,027
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    1. var merge = require('react/lib/merge');
    2. var EventEmitter = require('events').EventEmitter;
    3. var _state = {};
    4. var _EVENT_CHANGE = 'testing:change';
    5. module.exports = merge(EventEmitter.prototype, {
    6. get: function(name) {
    7. return name ? _state[name] : _state;
    8. },
    9. set: function(name, value) {
    10. _state[name] = value;
    11. var arg = {};
    12. arg[name] = value;
    13. this.emitChange(arg);
    14. },
    15. addChangeListener: function(callback) {
    16. this.on(_EVENT_CHANGE, callback);
    17. },
    18. removeChangeListener: function(callback) {
    19. this.removeListener(_EVENT_CHANGE, callback);
    20. },
    21. emitChange: function(arg) {
    22. this.emit(_EVENT_CHANGE, arg);
    23. }
    24. });
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /