npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cljimenez/json-serializer-vue-localstorage-reactive

v1.0.0

Published

Wrapper to use @cljimenez/json-serializer-core and @cljimenez/json-serializer-base-serializer with @cljimenez/vue-localstorage-reactive

Downloads

10

Readme

Wrapper to use @cljimenez/json-serializer-core and @cljimenez/json-serializer-base-serializers with @cljimenez/vue-localstorage-reactive

🏠 Homepage

Index

Install

@cljimenez/json-serializer-vue-localstorage-reactive

How to use?

  • Obtain the JsonSerializerAdapter object

    The JsonSerializerAdapter is an object used to wrap the @cljimenez/json-serializer-core to be used directly by @cljimenez/vue-localstorage-reactive, also it adds the serializers provided by @cljimenez/json-serializer-base-serializers. You can use this package with @cljimenez/vue-localstorage-reactive or with other elements that requires the parse and serialize methods described in About the JsonSerializerAdapter methods. You must use the createJsonSerializerAdapter function to create a JsonSerializerAdapter object.

    Example:

    import { createJsonSerializerAdapter } from '@cljimenez/json-serializer-vue-localstorage-reactive'
    
    // If you want to use the function serializer.
    const JsonSerializerAdapterWithFunctionSerializer =
      createJsonSerializerAdapter({ includeFunctionSerializer: true })
    
    // If you do not want to use the function serializer
    const JsonSerializerAdapterWithoutFunctionSerializer =
      createJsonSerializerAdapter()
  • About the JsonSerializerAdapter methods

    The JsonSerializerAdapter object provides the following methods:

    • (method) getSerializers(void): Returns an object that contains the serializers added to JsonSerializer object. The keys are obtained from serializer.getSerializerType method and the values are the Serializer objects.
    • (method) installSerializersAndRefreshJsonSerializer(serializersInstaller: SerializerInstaller, installOptions = {}): Adds serializers through the serializersInstaller and to update the JsonSerializer object.
    • (method) addSerializerAndRefreshJsonSerializer(serializer): Adds a Serializer and to update the JsonSerializer object.
    • (method) serialize(value, options = {}): Serializes the data. The optional options parameter contains some configuration used by the serialize algorithm.
    • (method) parse(value, options = {}): Unserializes the data serialized by serialize method. The optional options parameter contains some configuration used by the parse algorithm.
  • How to use @cljimenez/json-serializer-vue-localstorage-reactive with @cljimenez/vue-localstorage-reactive

    First you must install @cljimenez/vue-localstorage-reactive using:

    npm install @cljimenez/vue-localstorage-reactive

    Then, you can use it through the provide and inject functions.

    Example:

    // main.js
    import { createJsonSerializerAdapter } from '@cljimenez/json-serializer-vue-localstorage-reactive'
    import { createReactiveLocalStorageInstaller } from '@cljimenez/vue-localstorage-reactive'
    import { createApp } from 'vue'
    import App from './App.vue'
    
    const app = createApp(App)
    
    const serializer = createJsonSerializerAdapter({ includeFunctionSerializer: true })
    
    app.use(createReactiveLocalStorageInstaller(), { serializer })
    
    app.provide('reactiveLocalStorage', app.config.globalProperties.$reactiveLocalStorage)
    
    app.mount('#app')
    
    // App.vue
    <script setup>
    import { inject } from 'vue';
    
    const reactiveLocalStorage = inject('reactiveLocalStorage')
    
    const helloWord = reactiveLocalStorage.getItem('helloWord')
    
    if (helloWord) {
      console.log('from localStorage')
      helloWord()
    }
    
    reactiveLocalStorage.setItem('helloWord', () => {
      console.log('hello word')
      console.log('using reactiveLocalStorage and jsonSerializerAdapter')
    })
    
    </script>
    
    <template>
      <h1></h1>
    </template>

Author

👤 Cristopher Jiménez

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

📝 License

Copyright © 2023 Cristopher Jiménez. This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator