Skip to content

Introduce prefixes in bindAll#296

Open
goshacmd wants to merge 1 commit intojigish:masterfrom
goshacmd:bind-prefixes-js
Open

Introduce prefixes in bindAll#296
goshacmd wants to merge 1 commit intojigish:masterfrom
goshacmd:bind-prefixes-js

Conversation

@goshacmd
Copy link
Copy Markdown

Make slate.bindAll accept an optional argument of prefix map.

// simple mapping
slate.bindAll({ "esc:ctrl;alt" : S.op("relaunch") });

// with prefixes
slate.bindAll({ layoutKeys: "ctrl;cmd" }, {
  "l:#layoutKeys": laptop,
  "t:#layoutKeys": thunderbolt,
  "b:#layoutKeys": twoMonitor
});

Make `slate.bindAll` accept an optional argument of prefix map.

```javascript
// simple mapping
slate.bindAll({ "esc:ctrl;alt" : S.op("relaunch") });

// with prefixes
slate.bindAll({ layoutKeys: "ctrl;cmd" }, {
  "l:#layoutKeys": laptop,
  "t:#layoutKeys": thunderbolt,
  "b:#layoutKeys": twoMonitor
});
```
@lunixbochs
Copy link
Copy Markdown

The method I use in reslate for this uses nested objects like so:

slate.bindAll({
    'ctrl;cmd': {
        'l': laptop,
        't': thunderbolt,
        'b': twoMonitor
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants