All Projects → unbug → Domsnap

unbug / Domsnap

Licence: mit
Offline web pages by persist DOM to IndexedDB/WebSQL

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Domsnap

Angular Async Local Storage
Efficient local storage module for Angular apps and PWA: simple API + performance + Observables + validation
Stars: ✭ 539 (+618.67%)
Mutual labels:  indexeddb, offline
Remember
The progressive offline Todo app
Stars: ✭ 208 (+177.33%)
Mutual labels:  indexeddb, offline
React Relay Offline
TypeScript library files for Relay Modern Offline
Stars: ✭ 169 (+125.33%)
Mutual labels:  indexeddb, offline
localForage-cn
localForage中文仓库,localForage改进了离线存储,提供简洁健壮的API,包括 IndexedDB, WebSQL, 和 localStorage。
Stars: ✭ 201 (+168%)
Mutual labels:  offline, indexeddb
Dsw
Dynamic Service Worker - making your offline Progressive Web Apps way easier
Stars: ✭ 277 (+269.33%)
Mutual labels:  indexeddb, offline
sync-client
SyncProxy javascript client with support for all major embedded databases (IndexedDB, SQLite, WebSQL, LokiJS...)
Stars: ✭ 30 (-60%)
Mutual labels:  offline, indexeddb
Offline First
🔌 Everything you need to know to create offline-first web apps.
Stars: ✭ 2,792 (+3622.67%)
Mutual labels:  indexeddb, offline
Localforage
💾 Offline storage, improved. Wraps IndexedDB, WebSQL, or localStorage using a simple but powerful API.
Stars: ✭ 19,840 (+26353.33%)
Mutual labels:  indexeddb, offline
Dexie.js
A Minimalistic Wrapper for IndexedDB
Stars: ✭ 7,337 (+9682.67%)
Mutual labels:  indexeddb, offline
React Native Learning Resources
Collection of some good resources for react-native ✨ 🔥 💥
Stars: ✭ 61 (-18.67%)
Mutual labels:  offline
Spotify Onthego
Download Spotify playlists by searching for audio files on YouTube
Stars: ✭ 66 (-12%)
Mutual labels:  offline
Prestashop
Free PWA & SPA for PrestaShop
Stars: ✭ 59 (-21.33%)
Mutual labels:  offline
Ng Toolkit
⭐️ Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
Stars: ✭ 1,116 (+1388%)
Mutual labels:  offline
Flatris
Fast-paced two-player web game
Stars: ✭ 1,162 (+1449.33%)
Mutual labels:  offline
Local Feature Android
Add online and offline text translation to Android apps
Stars: ✭ 60 (-20%)
Mutual labels:  offline
Regex101 Osx
Regex101 packaged as an offline Mac OSX application
Stars: ✭ 72 (-4%)
Mutual labels:  offline
Apprun
AppRun is a JavaScript library for developing high-performance and reliable web applications using the elm inspired architecture, events and components.
Stars: ✭ 1,087 (+1349.33%)
Mutual labels:  virtual-dom
Nanolightwallet
RaiBlocks Light Wallet written in NodeJS
Stars: ✭ 55 (-26.67%)
Mutual labels:  offline
Zeal
Offline documentation browser inspired by Dash
Stars: ✭ 9,164 (+12118.67%)
Mutual labels:  offline
K8s Offline
Offline installation package for kubernetes.
Stars: ✭ 72 (-4%)
Mutual labels:  offline

NPM

DOMSnap

Offline web pages by persisting DOM to IndexedDB/WebSQL. Please try the demo.

How it works

HTML5 provides LocalStorage, IndexedDB, and window.caches to build offline web apps. But all of these technologies, we can't miss local database. DOMSnap takes full advantage of offline technologies. Storing HTML to local IndexedDB/WebSQL and resumeing when you're offline. With DOMSnap, web pages can resume to their last state with less request to the server and less template render. Think offline is a long way out, why not just give DOMSnap a try?

Usage

1.Include dist/DOMSnap.min.js file in your HTML

<script src="DOMSnap.min.js"></script>

2.Or insttall the package

npm install --save domsnap

and require it in your files

var DOMSnap = require('domsnap');

Examples

//init DOMSnap
var DS = DOMSnap({
  onReady: function(){
    console.log('DOMSnap is ready');
  }
});

//capture snapshot html of #main
DS.capture('#main');
//capture with specified capture id
DS.capture('#main', {id: 'my_id'});

//set the html of #main by it's captured snapshot html
DS.resume('#main');
//set by specified capture id
DS.resume('#main',{id: 'my_id'});

domsnap

APIs

DOMSnap(config)

Initialize DOMSnap

Parameters

  • config object [optional]
    • config.onReady function will be called when DOMSnap is ready
    • config.version number Version control, Nonzero. Update is required if web app has been updated. Default is 1
    • config.scope string "host|path|or any string value". "host": location.host; "path": location.host+location.pathname; default is "path"
    • config.storeType string Data store to use. "IndexedDB" or "WebSQL", if not defined, use "WebSQL" for iOS and "IndexedDB" for others.
    • config.expires number Milliseconds of how long every snapshot will expires, default is 1 week. Note, new snapshots will never expires until the page reload.

Returns object {{capture: capture, resume: resume, get: get, getAll: getAll, remove: remove, clear: clear}|*}

.capture(selector, options)

capture snapshot html of the element matches the selector and store the result with a capture id

Parameters

  • selector string selector of the element
  • options object [optional]
    • options.id string or function capture id, if html is not null set id to null to store html as the default snapshot
    • options.html string or function snapshot html, set id to null to store html as the default snapshot
    • options.expires number Milliseconds of how long the snapshot will expires. Same value as initialize DOMSnap if it's not specified.

Returns DOMSnap

.resume(selector, options)

set the html of the element matches the selector [and capture id] by it's captured snapshot html

Parameters

  • selector string selector of the element
  • options object [optional]
    • options.id string or function capture id, if html is not null set id to null to store html as the default snapshot
    • options.fallback function a callback function, will be called if no snapshot matched

Returns DOMSnap

.watch(selector, options)

watch and auto capture the element matches the selector

Parameters

  • selector string or array selector[s] of the element[s]
  • options object [optional]
    • options.id string or function capture id
    • options.html string or function snapshot html

Examples

//e.g.1
DS.watch('#main');

//e.g.2
DS.watch('#main',{
  id: 'my_capture_id',//capture id
  html: 'my_snapshot_html'//snapshot html
});

//e.g.3
DS.watch('#main',{
  id: function(selector){ return 'generated_capture_id_for_'+selector;}, //return capture id
  html: function(selector){ return 'generated_snapshot_html_for_'+selector;} //return snapshot html
});

//e.g.4
DS.watch(['#main', '#another']);//watch multi elements

Returns DOMSnap

.get(selector, id)

retrun the captured snapshot html of the element matches the selector and capture id

Parameters

  • selector string selector of the element
  • id string [optional]capture id, the result be the default snapshot if it's not specified

Returns string html

.getAll(selector)

retrun all the captured snapshots html of the element matches the selector

Parameters

  • selector string selector of the element

Returns object all snapshots as object - e.g. {DEFAULT_CAPTURE_ID: 'html of DEFAULT_CAPTURE', my_id: 'html of my_id'}

.remove(selector, id)

remove the captured snapshot html of the element matches the selector [and capture id]

Parameters

  • selector string selector of the element
  • id string [optional]capture id, will empty all snapshots if it's not specified

Returns DOMSnap

.clear(version)

clear all captured snapshots

Parameters

  • version number [optional]Same value as initialize DOMSnap if it's not specified.

Returns DOMSnap

Roadmap & Make contributions

  • on-going Auto watch and auto resume.
  • Capture and resume script and css link.
  • Resume with DOM diff.
  • on-going Events(ready, before resume, after resume, before capture, after capture)

Build

  1. install requirements run npm install
  2. build and watch run gulp

Find me

LICENSE

The MIT License (MIT)

Copyright (c) <2016>

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].