Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

absync

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

absync

absync

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status Coverage Status

2.0 Notice

2.0 no longer includes the backend data sanitation part that 1.0 provided.

If you still require that functionality, you can rely on the 1.0 code, or have a look at sanitizr.

Overview

absync is a tool to synchronize data pools in Angular applications.

Concept

absync lets you construct caching services for entities. These entities are expected to be retrievable through REST API endpoints. The absync caching services will initially attempt to retrieve the collection of the entity and populate the internal cache.

When the service is instructed to retrieve an entity, it will first check the cache for the entity and, if the entity isn't found, request it from the REST API and cache the result.

absync can also connect with the backend via socket.io websockets. In that scenario, it expects entities to be emitted from the websocket.
If you have a collection named "devices" where the entity is named "device", absync would expect an event named "device" with the device entity as the payload. absync will then update the cache and emit entityNew and entityUpdated events as appropriate.

Entity deletions are signaled by a payload that contains only the ID of the entity. absync will then emit an entityRemoved event.

Usage

  1. Configure absync in your Angular app:

    angular.module( "app", [ "absync" ] )
    	.config( configure );
    
    /* @ngInject */
    function configure( absyncProvider ) {
    	// io is expected to be the global socket.io instance.
    	absyncProvider.configure( io );
    }
    
  2. Construct caching services in Angular to hold the data:

    angular
    	.module( "devices" )
    	.config( registerDevicesService )
    	.run( configureService );
    
    /* @ngInject */
    function registerDevicesService( absyncProvider ) {
    	absyncProvider.collection( "devices",
    		{
    			model          : "Device",
    			collectionName : "devices",
    			collectionUri  : "/api/devices",
    			entityName     : "device",
    			entityUri      : "/api/device"
    		}
    	);
    }
    
    /* @ngInject */
    function configureService( devices ) {
    	// Do something with your absync service
    }
    

FAQs

Package last updated on 19 Dec 2016

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