Skip to content

Latest commit

 

History

History
25 lines (22 loc) · 691 Bytes

direct_usage.md

File metadata and controls

25 lines (22 loc) · 691 Bytes

Direct Usage

You can load directly by including myLackey and call load giving a specific URI. For example:

import { myLackey } from 'myLackey'
...
componentWillMount () {
  myLackey.load('/users')
}

Once you have data lackey available, you can check on the status of the loading:

  render() {
    const stillLoading = myLackey.loading('/users')

    return stillLoading
      ? <div>Loading...</div>
      : <div>...</div>
  }

Also available:

  • loaded(uri) or loaded(uris...) returns true if the data is already loaded.
  • failed(uri) returns true if the data loading promise failed.
  • unload(uri) or unload(uris) marks the given URIs unloaded