Skip to content

Commit f47bfe3

Browse files
committed
feat: Add quick reference helper phantom._() for OIE
- Add phantom._() function for quick reference - Shows all available categories when typing phantom. - Add toString() method to phantom object - Makes it easier to discover available options in OIE - Usage: Just type phantom._() to see what's available
1 parent f9c9778 commit f47bfe3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

phantom.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,36 @@
377377
}
378378
};
379379

380+
// Quick reference - shows what's available after typing "phantom."
381+
phantom._ = function() {
382+
var output = "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n";
383+
output += "🔍 Quick Reference: phantom.*\n";
384+
output += "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n";
385+
output += "Available categories:\n\n";
386+
387+
var categories = Object.keys(helpDocs);
388+
for (var i = 0; i < categories.length; i++) {
389+
var cat = categories[i];
390+
output += " phantom." + cat + "\n";
391+
output += " → " + helpDocs[cat].description + "\n";
392+
output += " → Try: phantom.help('" + cat + "')\n\n";
393+
}
394+
395+
output += "Helper functions:\n\n";
396+
output += " phantom.help() - Show all categories\n";
397+
output += " phantom.help('maps') - Show map operations\n";
398+
output += " phantom.autocomplete() - Get available options\n";
399+
output += " phantom.version - Get version\n";
400+
output += " phantom._ - Show this quick reference\n\n";
401+
output += "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n";
402+
return output;
403+
};
404+
405+
// Make it easy to see what's available - add a toString for phantom object
406+
phantom.toString = function() {
407+
return "Phantom.js v" + phantom.version + " - Use phantom._() or phantom.help() for help";
408+
};
409+
380410
// Only log on error (as requested)
381411
function logError(msg) {
382412
if (typeof logger !== "undefined") {

0 commit comments

Comments
 (0)