|
1 | 1 | /*! |
2 | | - * Phantom.js v0.1.5-BETA - A product of David Labs |
| 2 | + * Phantom.js v0.1.6-BETA - A product of David Labs |
3 | 3 | * ============================================ |
4 | 4 | * Lightweight helper library for OIE scripting |
5 | 5 | * |
6 | 6 | * Documentation: https://github.com/OS366/phantom/wiki |
7 | 7 | * |
| 8 | + * Available Categories (type "phantom." to see): |
| 9 | + * - phantom.maps - Map operations (channel, global, connector, response, configuration) |
| 10 | + * - phantom.strings - String operations (trim, replace, split, etc.) |
| 11 | + * - phantom.numbers - Number operations (add, subtract, round, etc.) |
| 12 | + * - phantom.json - JSON operations (parse, stringify, get, set, etc.) |
| 13 | + * - phantom.base64 - Base64 operations (encode, decode) |
| 14 | + * - phantom.xml - XML operations (parse, stringify, get, has) |
| 15 | + * - phantom.dates - Date operations (now, parse, format, etc.) |
| 16 | + * |
| 17 | + * Helper Functions: |
| 18 | + * - phantom.help() - Show all available operations |
| 19 | + * - phantom.help('maps') - Show operations for specific category |
| 20 | + * - phantom.autocomplete() - Get array of available options |
| 21 | + * - phantom._() - Quick reference guide |
| 22 | + * - phantom.version - Get current version |
| 23 | + * |
8 | 24 | * WARNING |
9 | 25 | * ------- |
10 | 26 | * Drag and drop is not possible for variables saved using phantom.maps.* |
|
407 | 423 | return "Phantom.js v" + phantom.version + " - Use phantom._() or phantom.help() for help"; |
408 | 424 | }; |
409 | 425 |
|
| 426 | + // Add enumerable properties for better autocomplete discovery in OIE |
| 427 | + // This helps editors show available options when typing "phantom." |
| 428 | + try { |
| 429 | + Object.defineProperty(phantom, 'maps', { |
| 430 | + enumerable: true, |
| 431 | + configurable: true, |
| 432 | + get: function() { return phantom.maps; } |
| 433 | + }); |
| 434 | + Object.defineProperty(phantom, 'strings', { |
| 435 | + enumerable: true, |
| 436 | + configurable: true, |
| 437 | + get: function() { return phantom.strings; } |
| 438 | + }); |
| 439 | + Object.defineProperty(phantom, 'numbers', { |
| 440 | + enumerable: true, |
| 441 | + configurable: true, |
| 442 | + get: function() { return phantom.numbers; } |
| 443 | + }); |
| 444 | + Object.defineProperty(phantom, 'json', { |
| 445 | + enumerable: true, |
| 446 | + configurable: true, |
| 447 | + get: function() { return phantom.json; } |
| 448 | + }); |
| 449 | + Object.defineProperty(phantom, 'base64', { |
| 450 | + enumerable: true, |
| 451 | + configurable: true, |
| 452 | + get: function() { return phantom.base64; } |
| 453 | + }); |
| 454 | + Object.defineProperty(phantom, 'xml', { |
| 455 | + enumerable: true, |
| 456 | + configurable: true, |
| 457 | + get: function() { return phantom.xml; } |
| 458 | + }); |
| 459 | + Object.defineProperty(phantom, 'dates', { |
| 460 | + enumerable: true, |
| 461 | + configurable: true, |
| 462 | + get: function() { return phantom.dates; } |
| 463 | + }); |
| 464 | + } catch (e) { |
| 465 | + // If defineProperty fails, properties are already set normally |
| 466 | + } |
| 467 | + |
410 | 468 | // Only log on error (as requested) |
411 | 469 | function logError(msg) { |
412 | 470 | if (typeof logger !== "undefined") { |
|
0 commit comments