Perforce 2013.1 Javascript API for Visual Tools
Perforce 2013.1 Javascript API for Visual Tools
Perforce 2013.1 Javascript API for Visual Tools
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Programming Applets<br />
case 'INFO':<br />
returnObj.msgMap.infos.push(stat);<br />
break;<br />
case 'VALID':<br />
returnObj.msgMap.valids.push(stat);<br />
break;<br />
}<br />
}, this);<br />
}<br />
return returnObj;<br />
// execute the command<br />
var p4out = P4JsApi.p4('fstat //depot/NotARealFile.cc //depot/... -m500');<br />
// process the results, looking <strong>for</strong> non-data messages<br />
var processedResults = processP4Result(p4out);<br />
// the processedResults object can contain any combination of data, and<br />
// error/warning/info messages. Some error messages are not necessarily<br />
// fatal. Application must determine how to handle interspersed data and<br />
// messages. This simple example logs them to the console.<br />
if (processedResults.hasErrors()) {<br />
console.error('ERRORS: ' + processedResults.msgMap.errors.join('\n'));<br />
}<br />
if (processedResults.hasWarnings()) {<br />
console.log('WARNINGS: ' + processedResults.msgMap.warningss.join('\n'));<br />
}<br />
if (processedResults.hasInfos()) {<br />
console.log('INFO: ' + processedResults.msgMap.infos.join('\n'));<br />
}<br />
// use the data<br />
if (processedResults.data.length>0) {<br />
// handle data response<br />
console.log('got data');<br />
// ...<br />
}<br />
14 <strong>Per<strong>for</strong>ce</strong> <strong>2013.1</strong> JavaScript <strong>API</strong> <strong>for</strong> <strong>Visual</strong> <strong>Tools</strong>