![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.
pro-gallery-lib
Advanced tools
The pro-gallery-lib containys helpers and files that can be imported individually.
The pro-gallery-lib exports Blueprints
and BlueprintsManager
The BlueprintsManager is a class that takes care of fetching needed params and creating a new blueprint when it might be needed.
The blueprintsManager works with an api provided by the user (see blow)
Function Name | description | arguments | return |
---|---|---|---|
async createBlueprint | Used when changes were made that might require a new blueprint, params can be empty - the manager will fetch by the provided api | params: {options, items, container, totalItemsCount} | {blueprint: object, blueprintChange: boolean} |
init | call to provide the deviceType and api | config: {api, deviceType, totalItemsCount} | -- |
getMoreItems | Call this when the gallery needs more items | currentItemsLength: number | -- |
To use the blueprints Manager to the full extent you need to provide it with an api to be able to manage fetching needed data and updating on ready blueprints.
An example can be found in the Playground code
Function Name | description | arguments | expected return |
---|---|---|---|
fetchMoreItems | Will be called when the BM requires more items (under the totalItemsCount) | currentItemLength: number | -- |
fetchItems | Will be called by the BM to get the current items | -- | items |
fetchOptions | Will be called by the BM to get the current options | -- | options |
fetchContainer | Will be called by the BM to get the current container | -- | container |
getTotalItemsCount | Will be called by the BM to get the totalItemsCount | -- | totalItemsCount: number |
onBlueprintReady | Will be called by the BM when a requested blueprint is ready | {blueprint: object, blueprintChanged: boolean} | -- |
isUsingCustomInfoElements | Will be called by the BM to know if Custom Info Elements are used | -- | boolean |
import { BlueprintsManager, GALLERY_CONSTS } from 'pro-gallery-lib'
const blueprintsManager = new BlueprintsManager({
id: `gallery1`,
});
const blueprintsApi = {
fetchMoreItems(currentItemLength) {
// fire your get more items method here; no return expected;
}
fetchItems() {
//return the current items array;
}
fetchOptions() {
//return the current options object;
}
fetchContainer() {
//return the current container object;
}
getTotalItemsCount() {
//return the current totalItemsCount;
}
onBlueprintReady({ blueprint, blueprintChanged }) {
// set the new blueprint as the new state, blueprintChanged can be used to do this only if there was an actual change in the blueprint object.
}
isUsingCustomInfoElements() {
// return true/false to reflect the usage of Custom info elements. used to process the options accordingly.
}
}
blueprintsManager.init({
api: blueprintsApi,
deviceType: GALLERY_CONSTS.deviceType.DESKTOP,
// totalItemsCont, This is optional and can be passed in the params in createBlueprint(params) or via the api;
});
const triggerBlueprintCreation = () => { //call this whenever something changes (options/ items/ container...anything). If this was called and nothing relevant changed the BM will call the onBlueprintReady api with a false blueprintChanged flag.
blueprintsManager.createBlueprint({}); //since the api is used params can be empty, the BM will use the provided api to fetch all the needed params to create a blueprint.
}
Here we use the ProGalleryRenderer
instead of the ProGallery
.
Instead of the normal options, items, container props we will destruct the blueprint
we got from the blueprintsManager
into the props.
import { ProGalleryRenderer } from 'pro-gallery'
import 'pro-gallery/dist/statics/main.css';
<ProGalleryRenderer
id={id}
{...blueprint}
scrollingElement = { () => document.getElementById('gallery') || window }
eventsListener = {(eventName, eventData) => console.log({eventName, eventData})}
createMediaUrl = {({item, originalUrl, resizeMethod, requiredWidth, requiredHeight}) => `https://...`}
isPrerenderMode = {isPrerenderMode}
/>
FAQs
Unknown package
The npm package pro-gallery-lib receives a total of 326 weekly downloads. As such, pro-gallery-lib popularity was classified as not popular.
We found that pro-gallery-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.