diff options
author | portix <none@none> | 2012-11-23 02:17:12 +0100 |
---|---|---|
committer | portix <none@none> | 2012-11-23 02:17:12 +0100 |
commit | 4a8384b7845ef9f5d376a2653af7541c59208251 (patch) | |
tree | 4a03edf638b6ded9d96eab7fb643891a8e766711 /api/jsapi.txt | |
parent | a018f961010258d20d174c53dcad2972f6d8a5ab (diff) | |
download | dwb-4a8384b7845ef9f5d376a2653af7541c59208251.zip |
Adding defaultConfig documentation to public api
Diffstat (limited to 'api/jsapi.txt')
-rw-r--r-- | api/jsapi.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/api/jsapi.txt b/api/jsapi.txt index 36824f2d..44ebcea0 100644 --- a/api/jsapi.txt +++ b/api/jsapi.txt @@ -2709,6 +2709,9 @@ the extension should unregister all signals and unbind all shortcuts in this function. +init+ and +end+ should be returned from the extension. +Additionally the returned object can also have an +defaultConfig+-property, the +value will be passed to extensions.getConfig before calling the init function. + .Example A extension called *foobar* in +$HOME/.local/share/dwb/extensions/foobar+. @@ -2725,6 +2728,8 @@ function loadStatusCallback(w) { ... } return { + defaultConfig : { foo : 37 }, + init : function (config) { if (config.foo > 36) { bar(config.foo); @@ -2736,6 +2741,7 @@ return { return false; }, + end : function () { unbind(bar); signals.disconnectByFunction(loadStatusCallback); @@ -2756,5 +2762,32 @@ return { -------- ==== +Extensions that provide a public api can use provide or replace using the name of the extension. + +==== +[source,javascript] +-------- +var myPublicFunction = function() +{ + ... +}; + +return { + init : function(config) + { + provide("myExtensionName", + { + config : config, + method : myPublicFunction + }); + }, + end : function() + { + replace("myExtensionName"); + } +}; +-------- +==== + // vim: set ft=asciidoc: |