Giter VIP home page Giter VIP logo

orchy-storage-plugin's Introduction

orchy-storage-plugin

This plugin allows you to store your data inside the local or session storage using the orchy's eventBus.

Plugin configuration

The plugin accepts one attribute:

  • strategy: it is used to configure the storage kind for your data. Actually only local and session are supported.

The plugin accepts one property:

  • eventBus: the orchy's eventBus instance.

Configuration example

Note that the eventBus property will be automatically injected by orchy.

JSON

{
    "type": "element",
    "tag": "orchy-storage-plugin",
    "url": "//localhost:3000/orchy-storage-plugin.js",
    "attributes": {
        "strategy": "local", // or "session"
    }
}

HTML

<script type="module" src="//localhost:3000/orchy-storage-plugin.js"></script>
<orchy-storage-plugin orchy-element strategy="local"></orchy-storage-plugin>

EventBus messages

Retrieve data

To retrieve your data, you should send a message following this format:

{
    label: 'orchy-storage:get',
    payload: {
        key: any;
    }
}

The label has been defined as a constant in the OrchyStorageEventsLabels.GET module.
We suggest to use the orchyStorageEventsBuilder.get function to create this structure.

If your data is correctly retrieved, you will receive a message with the following format:

{
    label: 'orchy-storage:get:result',
    payload: {
        key: any;
        value: any;
    }
}

The label has been defined as a constant in the OrchyStorageEventsLabels.GET_RESULT module.

Insert data

To insert your data, you should send a message following this format:

{
    label: 'orchy-storage:post',
    payload: {
        key: any;
        value: any;
    }
}

The label has been defined as a constant in the OrchyStorageEventsLabels.POST module.
We suggest to use the orchyStorageEventsBuilder.post function to create this structure.

Delete data

To delete your data, you should send a message following this format:

{
    label: 'orchy-storage:delete',
    payload: {
        key: any;
    }
}

The label has been defined as a constant in the OrchyStorageEventsLabels.DELETE module.
We suggest to use the orchyStorageEventsBuilder.delete function to create this structure.

Clear all data

To clear all data, you should send a message following this format:

{
    label: 'orchy-storage:clear',
}

The label has been defined as a constant in the OrchyStorageEventsLabels.CLEAR module.
We suggest to use the orchyStorageEventsBuilder.clear function to create this structure.

orchy-storage-plugin's People

Contributors

renovate[bot] avatar ilteoood avatar

Watchers

 avatar Kostas Georgiou avatar  avatar

orchy-storage-plugin's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Fallback to renovate.json file as a preset is deprecated, please use a default.json file instead.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/pipeline.yml
  • actions/checkout v4
  • actions/setup-node v4
  • pnpm/action-setup v3.0.0
npm
package.json
  • lit ^3.1.3
  • rxjs ^7.8.1
  • @typescript-eslint/eslint-plugin ^7.7.0
  • @typescript-eslint/parser ^7.7.0
  • @vitest/coverage-c8 ^0.31.4
  • eslint ^8.57.0
  • eslint-config-prettier ^9.1.0
  • eslint-plugin-prettier ^5.1.3
  • eslint-plugin-simple-import-sort ^12.1.0
  • happy-dom ^14.7.1
  • prettier ^3.2.5
  • rollup-plugin-visualizer ^5.12.0
  • typescript ^5.4.5
  • vite ^5.2.9
  • vitest ^0.31.4

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.