]> git.gir.st - VimFx.git/commit
Rework programmatic customization of VimFx
authorSimon Lydell <simon.lydell@gmail.com>
Thu, 28 Jan 2016 21:05:54 +0000 (22:05 +0100)
committerSimon Lydell <simon.lydell@gmail.com>
Tue, 16 Feb 2016 20:11:26 +0000 (21:11 +0100)
commit4adc17a111044ac19e0c3c3d1ef21e22cf6d2f62
tree2bf482d742b9f7fb31dd5a33dc730b818b0e7faa
parentd602407baa4c6bd29cc93bea93fa31bc38dfcf8f
Rework programmatic customization of VimFx

- The public API has been removed. While the idea of allowing other extensions
  to extend VimFx is neat, I don't think it'll ever be used. KISS. As a
  replacement, the config files have become more top-notch.

- The former public API is now the config file API.

- Config files are no longer regular add-ons. We used to provide a boilerplate
  for such an add-on, which consisted of a bunch of files users most likely
  wouldn't touch as well as `config.js` and `frame.js`. Now, the concept of
  `config.js` and `frame.js` has been kept, but they are loaded directly, if the
  path to their parent directory is given in the `config_file_directory` pref.
  This is much easier and simpler, and does not require the user to install a
  version of Firefox with the ability to install unsign add-ons (or having to go
  through the hassle of actually signing the "config file add-on").

- `zr` reloads the config file(s). This is possible because of the above point
  and is much nicer than having to restart Firefox every time you change your
  config (or setting up something like the Extension Auto-Installer).

- `vimfx.send(...)` and `vimfx.listen(...)` have been added, to make it easier
  to create custom commands that interact with web page content, which is quite
  common. These are basically `messageManager.send` and `messageManager.listen`.
  To make the API simpler, instead of passing the name of the callback message
  to listeners and having to do `messageManager.send(callback, data)` to respond
  to a message, a real callback _function_ is now passed instead, which does the
  message sending behind the scenes. This also resulted in some nice code
  cleanup overall.

- `vimfx.off(...)` has been added, to remove `vimfx.on(...)` listeners. This is
  mostly used internally. Since `zr` allows reloading the config file,
  everything in it must be undoable.

- By loading `frame.js` directly, it is now possible to pass a real API to it,
  rather than relying on `VimFx*` properties on the global frame script object.

- The new, "real" frame script API now has tests. This involved adding support
  for running tests in frame scripts.

Fixes #682.
41 files changed:
documentation/CONTRIBUTING-CODE.md
documentation/api.md
documentation/config-file.md
documentation/options.md
documentation/tools.md
extension/bootstrap.coffee
extension/lib/api-frame.coffee [new file with mode: 0644]
extension/lib/api.coffee
extension/lib/commands-frame.coffee
extension/lib/commands.coffee
extension/lib/config.coffee [new file with mode: 0644]
extension/lib/defaults.coffee
extension/lib/events-frame.coffee
extension/lib/events.coffee
extension/lib/main-frame.coffee
extension/lib/main.coffee
extension/lib/message-manager.coffee
extension/lib/public.coffee [deleted file]
extension/lib/utils.coffee
extension/lib/vim-frame.coffee
extension/lib/vim.coffee
extension/lib/vimfx.coffee
extension/locale/de/vimfx.properties
extension/locale/en-US/vimfx.properties
extension/locale/fr/vimfx.properties
extension/locale/id/vimfx.properties
extension/locale/it/vimfx.properties
extension/locale/ja/vimfx.properties
extension/locale/nl/vimfx.properties
extension/locale/pt-BR/vimfx.properties
extension/locale/ru/vimfx.properties
extension/locale/sv-SE/vimfx.properties
extension/locale/zh-CN/vimfx.properties
extension/locale/zh-TW/vimfx.properties
extension/test/index.coffee
extension/test/test-api-frame.coffee [new file with mode: 0644]
extension/test/test-api.coffee
extension/test/test-utils.coffee
extension/test/tests-list-frame.js.tmpl [new file with mode: 0644]
extension/test/utils.coffee
gulpfile.coffee
Imprint / Impressum