https://github.com/djyde/cans-plugin-modal-store
cans plugin for creating modal stores
https://github.com/djyde/cans-plugin-modal-store
cans
Last synced: 5 months ago
JSON representation
cans plugin for creating modal stores
- Host: GitHub
- URL: https://github.com/djyde/cans-plugin-modal-store
- Owner: djyde
- Created: 2017-03-28T16:45:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-31T10:11:19.000Z (over 9 years ago)
- Last Synced: 2024-12-31T10:31:17.151Z (over 1 year ago)
- Topics: cans
- Language: JavaScript
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cans-plugin-modal-store
[](https://www.npmjs.com/package/cans-plugin-modal-store)
[](https://circleci.com/gh/djyde/cans-plugin-modal-store)
cans plugin for creating modal store.
## Usage
```js
import cans, { inject } from 'cans'
import modalStorePlugin from 'cans-plugin-modal-store'
import Modal from '/path/to/Modal'
const app = cans()
app.use(modalStorePlugin, { names: ['user'] })
const UserModal = inject(({ models }) => {
return (
Modal body
Hide Modal
)
})
const App = inject(({ models }) => {
return (
Show Modal
)
})
```
### options
- modals
- name: string - modal name
- emptyRecord: any - default modal record. `{}` is by default
- title: (record) => string | Element - function that compute the modal title
### observable property
- visible: boolean.
- title: string | Element - Computed modal value
- record: any - Modal record
- resetRecord(): reset record to `emptyRecord`
- confirmLoading: boolean. Loading status
- startLoading(): set `confirmLoading` to true
- stopLoading(): set `confirmLoading` to false
- show(record): set `visible` to true. `record` is optional
- hide(): set `visible` to false
# License
MIT License