1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 15:07:57 +01:00

Add contexts.withContext.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-07 23:51:29 -05:00
parent 76dee44cb9
commit 51a9fc8dea
5 changed files with 14 additions and 13 deletions

View File

@@ -270,7 +270,13 @@ var Contexts = Module("contexts", {
get default() (contexts.context && contexts.context.group || contexts.user)[name],
completer: function (context) completion.group(context)
})
}),
withContext: function withContext(defaults, callback, self)
this.withSavedValues(["context"], function () {
this.context = defaults && update({}, defaults);
return callback.call(self, this.context);
})
}, {
Context: modules.Script = function Context(file, group, args) {
function Const(val) Class.Property({ enumerable: true, value: val });