|
104 | 104 | * [RUNTIME][100] |
105 | 105 | * [Parameters][101] |
106 | 106 | * [Examples][102] |
| 107 | +* [addCommand][103] |
| 108 | + * [Parameters][104] |
| 109 | + * [Examples][105] |
107 | 110 |
|
108 | 111 | ## mapkey |
109 | 112 |
|
@@ -702,6 +705,24 @@ RUNTIME('getTabs', {queryInfo: {currentWindow: true}}, response => { |
702 | 705 | }); |
703 | 706 | ``` |
704 | 707 |
|
| 708 | +## addCommand |
| 709 | + |
| 710 | +Add a command into Omnibar. |
| 711 | + |
| 712 | +### Parameters |
| 713 | + |
| 714 | +* `name` **[string][103]** the name of the command, used as command name in omnibar. |
| 715 | +* `description` **[string][103]** a help message to describe the command. |
| 716 | +* `jscode` **[function][104]** a Javascript function to be bound. If the command receives an argument, the argument will be passed to the function. |
| 717 | + |
| 718 | +### Examples |
| 719 | + |
| 720 | +```javascript |
| 721 | +addCommand("example", "An example command", function(arg) { |
| 722 | + console.log("You entered: " + arg); |
| 723 | +}); |
| 724 | +``` |
| 725 | + |
705 | 726 | [1]: #mapkey |
706 | 727 |
|
707 | 728 | [2]: #parameters |
@@ -906,22 +927,28 @@ RUNTIME('getTabs', {queryInfo: {currentWindow: true}}, response => { |
906 | 927 |
|
907 | 928 | [102]: #examples-23 |
908 | 929 |
|
909 | | -[103]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String |
| 930 | +[103]: #addcommand |
| 931 | + |
| 932 | +[104]: #parameters-38 |
| 933 | + |
| 934 | +[105]: #examples-24 |
| 935 | + |
| 936 | +[106]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String |
910 | 937 |
|
911 | | -[104]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function |
| 938 | +[107]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function |
912 | 939 |
|
913 | | -[105]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object |
| 940 | +[108]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object |
914 | 941 |
|
915 | | -[106]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array |
| 942 | +[109]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array |
916 | 943 |
|
917 | | -[107]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean |
| 944 | +[110]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean |
918 | 945 |
|
919 | | -[108]: https://developer.mozilla.org/docs/Web/HTML/Element |
| 946 | +[111]: https://developer.mozilla.org/docs/Web/HTML/Element |
920 | 947 |
|
921 | | -[109]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number |
| 948 | +[112]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number |
922 | 949 |
|
923 | | -[110]: https://github.com/brookhong/Surfingkeys/wiki/Register-inline-query |
| 950 | +[113]: https://github.com/brookhong/Surfingkeys/wiki/Register-inline-query |
924 | 951 |
|
925 | | -[111]: https://developer.mozilla.org/docs/Web/API/Element |
| 952 | +[114]: https://developer.mozilla.org/docs/Web/API/Element |
926 | 953 |
|
927 | | -[112]: https://github.com/ajaxorg/ace/blob/ec450c03b51aba3724cf90bb133708078d1f3de6/lib/ace/keyboard/vim.js#L927-L1099 |
| 954 | +[115]: https://github.com/ajaxorg/ace/blob/ec450c03b51aba3724cf90bb133708078d1f3de6/lib/ace/keyboard/vim.js#L927-L1099 |
0 commit comments