Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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],
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);
}
}
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;
}
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;
}
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);
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);
}
}
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);
}
var off = function() {
cordova_events.removeListener.apply(cordova_events, arguments);
};
var emit = function() {
cordova_events.emit.apply(cordova_events, arguments);
};
removeAllListeners:function() {
cordova_events.removeAllListeners.apply(cordova_events, arguments);
},
emit: emit,