![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
data-lackey
Advanced tools
Give Data Lackey a spin! Data Lackey orchestrates data loading for rich front-end JS applications.
With Data Lackey:
At a basic level, Data Lackey keeps track of the loading of your data, so it's not buried in or distributed throughout components or middleware:
rules
&
loaders
⬇
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯→ load ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯→ Configured Data Lackey ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯→ promise for data
(resource uri)
It layers on top of this :
$ yarn add data-lackey
You'll need create a "data lackey" to track your data loading. Creating a file for this:
// File: lackey.js -- or whatever you want
import { DataLackey } from 'data-lackey'
export const lackey = new DataLackey()
lackey.rule('/books', { loader: () => fetch('/api/books') })
lackey.rule('/book :bookId', { loader: ({bookId}) => fetch(`/api/books/${bookId}`),
dependsOn: 'books' })
More details on patterns and rules.
Very simply, you can call lackey.load('/books')
to call the underlying fetch
. This is
nice because you can hide some details in the loader that you don't want in the load call--
but probably not worth restructuring your code for. But when you have dependencies
between different pieces of data-- the above the code wants the books index to be called before
an individual book-- it is convenient. Calling load('/book 8')
will return a promise that
includes the loading of the /books
endpoint. These dependencies (promise chains) can become
quite complex if you have a larger webapp.
This direct usage is outlined here.
Data Lackey understands React components, and offers a HOC to manage the loading of data. Individual components can be completely free of data loading responsibilities.
Configure your component with a new wrapping method mapPropsToDataRsrcs
:
// File: myComponent.js
import { loadData } from 'data-lackey'
import MyComponent from './MyComponent.jsx'
const mapPropsToDataRsrcs = props => `/book ${this.props.id}`,
WrappedComponent = loadData(mapPropsToDataRsrcs)(MyComponent)
export default WrappedComponent
Now, when the component is mounted, the book
details will be requested. Since
that is dependent on the books
data as well, that will be loaded first.
Usage within React is 100% configuration driven and is outlined here.
Data Lackey itself is well tested. One of the benefits of Data Lackey is that it separates the loading of data from the component itself. The loaders can be unit tested (they are functional in nature), and should simplify your component tests.
data resource
: a single set of data that can be loaded.data uri
: a string identifying a single resource.load
: request the loading of a data resource.undefined
: unknown data resource, not yet trackedloading
loaded
=> action unload
failed to load
FAQs
orchestrate your data loading
The npm package data-lackey receives a total of 23 weekly downloads. As such, data-lackey popularity was classified as not popular.
We found that data-lackey demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.