https://github.com/electron-utils/electron-selection
Global Selection
https://github.com/electron-utils/electron-selection
electron selection ui
Last synced: 2 months ago
JSON representation
Global Selection
- Host: GitHub
- URL: https://github.com/electron-utils/electron-selection
- Owner: electron-utils
- License: mit
- Created: 2017-04-25T02:24:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-25T10:10:23.000Z (about 8 years ago)
- Last Synced: 2025-02-22T02:02:37.106Z (3 months ago)
- Topics: electron, selection, ui
- Language: JavaScript
- Size: 51.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-selection
[](https://travis-ci.org/electron-utils/electron-selection)
[](https://ci.appveyor.com/project/jwu/electron-selection)
[](https://david-dm.org/electron-utils/electron-selection)
[](https://david-dm.org/electron-utils/electron-selection#info=devDependencies)Global Selection
## Why?
- Sync selection in multiple windows
## Install
```bash
npm install --save electron-selection
```## Run Examples:
```bash
npm start examples/${name}
```## Usage
```javascript
const selection = require('electron-selection');selection.register('normal');
selection.select('normal', ['a', 'b', 'c', 'd']);// ['a', 'b', 'c', 'd']
console.log(selection.curSelection('normal'));
```## API Reference
### Methods
#### selection.register (type)
- `type` string
#### selection.reset ()
#### selection.local ()
Returns a `selection.ConfirmableSelectionHelper` instance.
#### selection.confirm ()
Confirms all current selecting objects, no matter which type they are.
This operation may trigger deactivated and activated events.#### selection.cancel ()
Cancels all current selecting objects, no matter which type they are.
This operation may trigger selected and unselected events.#### selection.confirmed (type)
- `type` string
Check if selection is confirmed.
#### selection.select (type, id[, unselectOthers, confirm])
- `type` string
- `id` string
- `unselectOthers` boolean
- `confirm` booleanSelect item with its id.
#### selection.unselect (type, id[, confirm])
- `type` string
- `id` string
- `confirm` booleanUnselect item with its id.
#### selection.hover (type, id)
- `type` string
- `id` stringHover item with its id. If id is null, it means hover out.
#### selection.setContext (type, id)
- `type` string
- `id` string#### selection.patch (type, srcID, destID)
- `type` string
- `srcID` string
- `destID` string#### selection.clear (type)
- `type` string
#### selection.hovering (type)
- `type` string
#### selection.contexts (type)
- `type` string
#### selection.curActivate (type)
- `type` string
#### selection.curGlobalActivate (type)
- `type` string
#### selection.curSelection (type)
- `type` string
#### selection.filter (items, mode, func)
- `items` array(string)
- `mode` string - 'top-level', 'deep' and 'name'
- `func` function## License
MIT © 2017 Johnny Wu