How to use the cordova-common.events function in cordova-common

To help you get started, we’ve selected a few cordova-common 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 apache / cordova-lib / cordova-lib / src / cordova / platform.js View on Github external
// platform, it is going to create.
                    platformDetails: platDetails,
                    link: opts.link
                };

                if (config_json && config_json.lib && config_json.lib[platform] &&
                    config_json.lib[platform].template) {
                    options.customTemplate = config_json.lib[platform].template;
                }

                events.emit('log', (cmd === 'add' ? 'Adding ' : 'Updating ') + platform + ' project...');
                var PlatformApi = cordova_util.getPlatformApiFunction(platDetails.libDir, platform);
                var destination = path.resolve(projectRoot, 'platforms', platform);
                var promise = cmd === 'add' ?
                    PlatformApi.createPlatform.bind(null, destination, cfg, options, events) :
                    PlatformApi.updatePlatform.bind(null, destination, options, events);
                return promise()
                .then(function () {
                    if (!opts.restoring) {
                        return prepare.preparePlatforms([platform], projectRoot, { searchpath: opts.searchpath });
                    }
                })
                .then(function() {
                    if (cmd == 'add') {
                        return installPluginsForNewPlatform(platform, projectRoot, opts);
                    }
                })
                .then(function () {
                    if (!opts.restoring) {
                        // Call prepare for the current platform if we're not restoring from config.xml.
                        var prepOpts = {
                            platforms :[platform],
github katzer / cordova-plugin-badge / platforms / ios / cordova / Api.js View on Github external
function setupEvents (externalEventEmitter) {
    if (externalEventEmitter) {
        // This will make the platform internal events visible outside
        events.forwardEventsTo(externalEventEmitter);
    } else {
        // There is no logger if external emitter is not present,
        // so attach a console logger
        CordovaLogger.get().subscribe(events);
    }
}
github maishumaishu / ChiTuStore2 / user / platforms / android / cordova / Api.js View on Github external
function setupEvents(externalEventEmitter) {
    if (externalEventEmitter) {
        // This will make the platform internal events visible outside
        selfEvents.forwardEventsTo(externalEventEmitter);
        return externalEventEmitter;
    }

    // There is no logger if external emitter is not present,
    // so attach a console logger
    CordovaLogger.get().subscribe(selfEvents);
    return selfEvents;
}
github apache / cordova-android / bin / templates / cordova / Api.js View on Github external
function setupEvents (externalEventEmitter) {
    if (externalEventEmitter) {
        // This will make the platform internal events visible outside
        selfEvents.forwardEventsTo(externalEventEmitter);
        return externalEventEmitter;
    }

    // There is no logger if external emitter is not present,
    // so attach a console logger
    CordovaLogger.get().subscribe(selfEvents);
    return selfEvents;
}
github apache / cordova-lib / cordova-lib / src / plugman / plugman.js View on Github external
configurable: true,
            get : function() { val = val || require(modulePath); return val; },
            set : function(v) { val = v; }
        });
    }

    // The plugman.raw.foo
    Object.defineProperty(o.raw, symbol, {
        configurable: true,
        get : function() { val = val || require(modulePath); return val; },
        set : function(v) { val = v; }
    });
}

var plugman = {
    on:                 events.on.bind(events),
    off:                events.removeListener.bind(events),
    removeAllListeners: events.removeAllListeners.bind(events),
    emit:               events.emit.bind(events),
    raw:                {}
};

addProperty(plugman, 'install', './install', true);
addProperty(plugman, 'uninstall', './uninstall', true);
addProperty(plugman, 'fetch', './fetch', true);
addProperty(plugman, 'browserify', './browserify');
addProperty(plugman, 'help', './help');
addProperty(plugman, 'config', './config', true);
addProperty(plugman, 'owner', './owner', true);
addProperty(plugman, 'search', './search', true);
addProperty(plugman, 'info', './info', true);
addProperty(plugman, 'create', './create', true);
github QuickBlox / quickblox-javascript-sdk / samples / chat-cordova / platforms / ios / cordova / Api.js View on Github external
function setupEvents(externalEventEmitter) {
    if (externalEventEmitter) {
        // This will make the platform internal events visible outside
        events.forwardEventsTo(externalEventEmitter);
    } else {
        // There is no logger if external emitter is not present, 
        // so attach a console logger
        CordovaLogger.get().subscribe(events);
    }
}
github apache / cordova-windows / template / cordova / Api.js View on Github external
function setupEvents (externalEventEmitter) {
    if (externalEventEmitter) {
        // This will make the platform internal events visible outside
        events.forwardEventsTo(externalEventEmitter);
        return;
    }

    // There is no logger if external emitter is not present,
    // so attach a console logger
    CordovaLogger.get().subscribe(events);
}
github apache / cordova-lib / cordova-lib / src / cordova / cordova.js View on Github external
var off = function() {
    cordova_events.removeListener.apply(cordova_events, arguments);
};
github apache / cordova-lib / cordova-lib / src / cordova / cordova.js View on Github external
var emit = function() {
    cordova_events.emit.apply(cordova_events, arguments);
};
github apache / cordova-lib / cordova-lib / src / cordova / cordova.js View on Github external
removeAllListeners:function() {
        cordova_events.removeAllListeners.apply(cordova_events, arguments);
    },
    emit:      emit,