@attrs/modal
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

@attrs/modal

Installation

$ npm install @attrs/modal --save

Usage

import Modal from '@attrs/modal';

const options = {
  id: 'id',
  cls: 'cls1 cls2',
  style: {
    'color': '#333',
    'border-radius': '8px'
  },
  maskbg: 'rgba(0,0,0,.24)',
  closable: true,
  width: '50%',
  height: 600,
  margin: '35px',
  background: '#fff',
  shadow: '#000 0px 5px 15px',
  fullsize: false,
  closebtn: true,
  contents: 'contents'
};

// class style
let instance = new Modal(options);
instance.contents('new contents');
instance.open();

setTimeout(() => {
  instance.close();
}, 15000);

// static methods
await Modal.open({ contents: 'a' });
await Modal.open({ contents: 'b' });
await Modal.open({ contents: 'c' });
const ids = Modal.ids();
console.log('ids', ids);
console.log('current', Modal.current());
console.log('get', Modal.get(ids[0]));

setTimeout(() => {
  Modal.close(ids[0]);
}, 5000);

setTimeout(() => {
  Modal.closeAll();
}, 15000);

Readme

Keywords

none

Package Sidebar

Install

npm i @attrs/modal

Weekly Downloads

0

Version

0.2.2

License

MIT

Unpacked Size

33 kB

Total Files

16

Last publish

Collaborators

  • admin.attrs
  • aquarela53
  • joje