New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

offline-sync-handler-test

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

offline-sync-handler-test

Offline Sync Handler - data layer is implemented using IndexedDB allowing for offline data storage and synchronization with the server.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

Offline Sync Handler ☁️

Offline Sync Handler - data layer is implemented using IndexedDB allowing for offline data storage and synchronization with the server.

Installation 📜

$ npm install --save offline-sync-handler
$ yarn add offline-sync-handler

How to Use

  • Wrap your application with OfflineProvider in app.tsx file.
import { OfflineSyncProvider } from 'offline-sync-handler';

const MyApp = ({ Component, pageProps }) => {
  return (
    <OfflineSyncProvider>
      <Component {...pageProps} />
    </OfflineSyncProvider>
  );
};
  • Using the useOfflineSyncContext hook for the offline submission of Data.
import { useOfflineSyncContext } from 'offline-sync-handler';

export default const Sample: React.FC = () => {
  const { callApi } = useOfflineSyncContext();

  const handleSubmit = async () => {
    callApi({
      id: 'Sample',
      body: {
        user: '',        
      },
      endpoint: 'https://sample.com',
      method: 'post'      
    })
      .then(res => {
        if (res === 'offline'){
          // Implement your success code
        }
      })
      .catch(err => {
        // Implement your error code
      });
  };

  return (
    <>
      <Button
        className="sumbit-button"
        onClick={handleSubmit}        
      />
    </>
  );
};

export default Feedback;

Code of Conduct

License

Contribute

Show your ❤️ and support by giving a ⭐. Any suggestions are welcome! Take a look at the contributing guide.

FAQs

Package last updated on 30 Jul 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc