Props

Storages props is a feature available as of version 0.5.0. This feature allows the exhutation of methods by specifying the direct prop of the storage object.

You can also export props before you run them.

const { urls } = storages.props

urls.add('http://google.com')
const sites = await urls.get()  // [http://github.com, http://google.com]
urls.remove('http://github.com')  // [http://google.com]

props.*.get()

Returns the current value of prop.

const urls = await storages.websites.props.urls.get()

props.*.set(value)

any

Defines the value of a prop.

storages.websites.props.urls.set(['http://github.com'])

props.*.add(value)

any

Inserts a value into a prop, only for array type object.

storages.websites.props.urls.add('http://gogle.com')

props.*.remove(value)

string

int

Removes an item from an array or object. If the type is array, expect an index (type int), if object, expect the property name (type string).

// ulrs = ['my', 'name', 'is']
storages.websites.props.urls.remove(1)
// ['my', 'is']

// profiles = { name: 'Philippe', year: 1989}
storages.websites.props.profiles.remove('name')
// {year: 1989}

props.*.sync(callback)

function

Inserts a value into a prop, only for array type object.

storages.websites.props.urls.sync((err, data) => {})

// With syncErrorHandler defined.
storages.websites.props.urls.sync((data) => {})

props.*.discontinue()

Remove all prop syncs within scope.

storages.websites.props.urls.sync(data => console.log(data))

storages.websites.props.urls.discontinue()
// sync is removed

props.*.reset()

Restores the prop defining to its default value if the default value is set from schema.

storages.websites.props.urls.reset()

Next: Disconnectors