How to use event - 10 common examples

To help you get started, we’ve selected a few event examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github knowthelist / fhem-tablet-ui / www / tablet / lib / powerange.js View on Github external
Events.prototype.unbind = function(event, method){
  if (0 == arguments.length) return this.unbindAll();
  if (1 == arguments.length) return this.unbindAllOf(event);

  // no bindings for this event
  var bindings = this._events[event];
  if (!bindings) return;

  // no bindings for this method
  var cb = bindings[method];
  if (!cb) return;

  events.unbind(this.el, event, cb);
};
github abpetkov / powerange / dist / powerange.js View on Github external
Events.prototype.unbind = function(event, method){
  if (0 == arguments.length) return this.unbindAll();
  if (1 == arguments.length) return this.unbindAllOf(event);

  // no bindings for this event
  var bindings = this._events[event];
  if (!bindings) return;

  // no bindings for this method
  var cb = bindings[method];
  if (!cb) return;

  events.unbind(this.el, event, cb);
};
github everdom / ChromeQQ / src / lib / powerange.js View on Github external
Events.prototype.unbind = function(event, method){
  if (0 == arguments.length) return this.unbindAll();
  if (1 == arguments.length) return this.unbindAllOf(event);

  // no bindings for this event
  var bindings = this._events[event];
  if (!bindings) return;

  // no bindings for this method
  var cb = bindings[method];
  if (!cb) return;

  events.unbind(this.el, event, cb);
};
github humhub / humhub-modules-mail / resources / js / humhub.mail.notification.js View on Github external
var init = function(isPjax) {
        // open the messages menu

        if(!isPjax) {
            event.on('humhub:modules:mail:live:NewUserMessage', function (evt, events) {
                event = events[events.length - 1];
                setMailMessageCount(event.data.count);
            }).on('humhub:modules:mail:live:UserMessageDeleted', function (evt, events) {
                event = events[events.length - 1];
                setMailMessageCount(event.data.count);
            });


            $('#icon-messages').click(function () {

                if(currentXhr) {
                    currentXhr.abort();
                }

                // remove all <li> entries from dropdown
                $('#loader_messages').parent().find(':not(#loader_messages)').remove();</li>
github wso2 / product-es / modules / jaggery-modules / store / module / scripts / user.js View on Github external
user.init = function (options) {
        var event = require('event');
        event.on('tenantCreate', function (tenantId) {

        });

        event.on('tenantLoad', function (tenantId) {
            var registry = server.systemRegistry(tenantId);
            user.configs(tenantId, JSON.parse(registry.content(options.tenantConfigs)));
        });

        event.on('tenantUnload', function (tenantId) {

        });

        event.on('login', function (tenantId, usr, session) {
            var space,
                carbon = require('carbon');
            server.current(session, usr);
            session.put(USER_REGISTRY, new carbon.registry.Registry(server.instance(), {
                username: usr.username,
                tenantId: tenantId
            }));
            space = user.userSpace(usr);
            session.put(USER_SPACE, space);
            if (!usr.isAuthorized(space, carbon.registry.actions.PUT)) {
                event.emit('userRegister', tenantId, usr);
            }
        });

        event.on('logout', function (tenantId, usr, session) {
            server.current(session, null);
github wso2 / product-es / modules / apps / sso / modules / server.js View on Github external
tenantId: tenantId
        });
        //loads tenant's anon registry
        config[ANONYMOUS_REGISTRY] = new carbon.registry.Registry(server(), {
            tenantId: tenantId
        });
        //loads tenant's user manager
        config[USER_MANAGER] = new carbon.user.UserManager(server(), tenantId);
    });

    event.on('tenantUnload', function (tenantId) {
        var config = configs(tenantId);
        delete config[tenantId];
    });

    event.on('login', function (tenantId, user, session) {
        //we check the existence of user manager in the application ctx and
        //decide whether tenant has been already loaded.
        /*log.debug('login : ' + tenantId + ' User : ' + JSON.stringify(user));
         if (application.get(tenantId + USER_MANAGER)) {
         //return;
         }
         event.emit('tenantCreate', tenantId);
         event.emit('tenantLoad', tenantId);*/
        var carbon = require('carbon'),
            server = require('/modules/server.js'),
            loginManager = carbon.server.osgiService('org.wso2.carbon.core.services.callback.LoginSubscriptionManagerService'),
            configReg = server.systemRegistry(tenantId).registry.getChrootedRegistry("/_system/config"),
            domain = carbon.server.tenantDomain({
                tenantId: tenantId
            });
        loginManager.triggerEvent(configReg, user.username, tenantId, domain);
github wso2 / product-es / modules / jaggery-modules / store / module / scripts / server.js View on Github external
tenantId: tenantId
            });
            //loads tenant's anon registry
            config[ANONYMOUS_REGISTRY] = new carbon.registry.Registry(server.instance(), {
                tenantId: tenantId
            });
            //loads tenant's user manager
            config[USER_MANAGER] = new carbon.user.UserManager(server.instance(), tenantId);
        });

        event.on('tenantUnload', function (tenantId) {
            var config = server.configs(tenantId);
            delete config[tenantId];
        });

        event.on('login', function (tenantId, user, session) {
            //we check the existence of user manager in the application ctx and
            //decide whether tenant has been already loaded.
            /*log.info('login : ' + tenantId + ' User : ' + JSON.stringify(user));
             if (application.get(tenantId + USER_MANAGER)) {
             //return;
             }
             event.emit('tenantCreate', tenantId);
             event.emit('tenantLoad', tenantId);*/
            var carbon = require('carbon'),
                loginManager = carbon.server.osgiService('org.wso2.carbon.core.services.callback.LoginSubscriptionManagerService'),
                configReg = server.systemRegistry(tenantId).registry.getChrootedRegistry("/_system/config"),
                domain = carbon.server.tenantDomain({
                    tenantId: tenantId
                });
            loginManager.triggerEvent(configReg, user.username, tenantId, domain);
        });
github javve / list.fuzzysearch.js / dist / list.fuzzysearch.js View on Github external
exports.unbind = function(el, type, fn, capture){
  if (!isCollection(el)) {
    events.unbind(el, type, fn, capture);
  } else if ( el &amp;&amp; el[0] !== undefined ) {
    for ( var i = 0; i &lt; el.length; i++ ) {
      events.unbind(el[i], type, fn, capture);
    }
  }
};
});
github arturhoo / listjs-rails / app / assets / javascripts / list.fuzzysearch.js View on Github external
exports.unbind = function(el, type, fn, capture){
  if (!isCollection(el)) {
    events.unbind(el, type, fn, capture);
  } else if ( el &amp;&amp; el[0] !== undefined ) {
    for ( var i = 0; i &lt; el.length; i++ ) {
      events.unbind(el[i], type, fn, capture);
    }
  }
};
});
github javve / list.fuzzysearch.js / dist / list.fuzzysearch.js View on Github external
exports.bind = function(el, type, fn, capture){
  if (!isCollection(el)) {
    events.bind(el, type, fn, capture);
  } else if ( el &amp;&amp; el[0] !== undefined ) {
    for ( var i = 0; i &lt; el.length; i++ ) {
      events.bind(el[i], type, fn, capture);
    }
  }
};

event

Functional reactive style events

MIT
Latest version published 12 years ago

Package Health Score

42 / 100
Full package analysis

Popular event functions