Skip to content

Commit

Permalink
Version 0.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
martindiphoorn committed Jun 9, 2015
1 parent 9e84cd5 commit 86c46e5
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 214 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
#NgDexie#

##Version 0.0.14 (2015-06-09)##
* Dropped the unofficial support for dexiejs.syncable
* Dropped the dexie.js fork as perfmance changes are in the core now

##Version 0.0.13 (2015-04-10)##
* bind an object from the database on the scope
* use our own dexie.js github fork as it contains some performance changes
Expand Down
27 changes: 0 additions & 27 deletions README.md
@@ -1,31 +1,4 @@
#NgDexie#

##Major refactoring in v0.0.8, not compatible with older releases!##

quicknotes:
* Converter NgDexie to an provider
* idb.utils is changed in ngdexie and ngdexie.sync
* ngDexie.db has been removed
* ngDexie.getDb() introduced which returns an dexie db, but can also run handle a function(db){} as parameter

So now the config of your database is done in the config part of your app.
```
.config(function (ngDexieProvider) {
ngDexieProvider.setOptions({name: appConfig.database.name, debug: appConfig.database.debug});
ngDexieProvider.setConfiguration(function (db) {
db.version(1).stores({
notes: "++id,title",
});
db.on('error', function (err) {
// Catch all uncatched DB-related errors and exceptions
console.error("db error err=" + err);
});
});
})
```

The documentation has been updated. If you find an error please open an issue.


## QuickStart ##
You can find the [QuickStart here](https://github.com/FlussoBV/NgDexie/wiki/QuickStart)
5 changes: 2 additions & 3 deletions bower.json
@@ -1,6 +1,6 @@
{
"name": "NgDexie",
"version": "0.0.13",
"version": "0.0.14",
"authors": [
"Martin Diphoorn <m.diphoorn@flusso.nl>"
],
Expand Down Expand Up @@ -33,7 +33,6 @@
"Gruntfile.js"
],
"dependencies": {
"angular": ">= 1.2.0",
"dexie": "https://github.com/martindiphoorn/Dexie.js.git#V1.0.4.1"
"angular": ">= 1.2.0"
}
}
92 changes: 1 addition & 91 deletions build/ngDexie.js
@@ -1,6 +1,6 @@
/**
* Angularjs wrapper around Dexie.js an IndexedDB handler
* @version v0.0.13 - build 2015-04-10
* @version v0.0.14 - build 2015-06-09
* @link https://github.com/FlussoBV/NgDexie
* @license Apache License, http://www.apache.org/licenses/
*/
Expand Down Expand Up @@ -286,13 +286,10 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
* @returns {Function}
*/
function debounce(func, wait, immediate) {
console.log("debounce 1");
var timeout;
return function () {
console.log("debounce 2");
var context = this, args = arguments;
var later = function () {
console.log("debounce later");
timeout = null;
if (!immediate) {
func.apply(context, args);
Expand All @@ -311,93 +308,6 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
(function () {
'use strict';

/**
* Create ngdexie.sync module
*/
angular.module('ngdexie.sync', ['ngdexie.core']);

/**
* Create ngDexieUtils factory
*/
angular.module('ngdexie.sync')
.factory('ngDexieSync', ngDexieSync);

/*@ngInject*/
function ngDexieSync($rootScope, $q, ngDexie) {
if (ngDexie.getDb().syncable) {
ngDexie.getDb().syncable.on('statusChanged', function (newStatus, url) {
$rootScope.$apply(function () {
$rootScope.$broadcast("ngDexieStatusChanged", {status: newStatus, statusText: Dexie.Syncable.StatusTexts[newStatus], url: url});
});
});
}

return {
resync: resync,
unsyncedChanges: unsyncedChanges
};

/**
* Resync the database
* @param {type} url
* @param {type} storeNames
* @returns {undefined}
*/
function resync(url, storeNames) {
var db = ngDexie.getDb();

if (!angular.isArray(storeNames)) {
storeNames = [storeNames];
}

// Disconnect the synchronisation database
db.syncable.disconnect(url).then(function () {
var clearTables = 0;
angular.forEach(storeNames, function (storeName) {
var dbTable = db.table(storeName);
// Use single table transactions for safari
db.transaction("rw", dbTable, function () {
dbTable.clear();
}).then(function () {
clearTables++;
if (clearTables === storeNames.length) {
db.syncable.delete(url).then(function () {
setTimeout(function () {
db.syncable.connect("iSyncRestProtocol", url);
}, 1500);
});
}
});
});

});
}

/**
* Resync the database
/**
* Check if there are synchronisation changes
* @param {type} url
* @returns {undefined}
*/
function unsyncedChanges(url) {
var deferred = $q.defer();

var db = ngDexie.getDb();
if (angular.isDefined(db) && db.isOpen()) {
db.syncable.unsyncedChanges(url).then(function (data) {
deferred.resolve(data);
});
}

return deferred.promise;
}
}
ngDexieSync.$inject = ["$rootScope", "$q", "ngDexie"];
})();
(function () {
'use strict';

/**
* Create ngdexie.utils module
*/
Expand Down
4 changes: 2 additions & 2 deletions build/ngDexie.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion files.js
Expand Up @@ -2,7 +2,6 @@ routerFiles = {
src: [
'src/ngdexie.core.js',
'src/ngdexie.utils.js',
'src/ngdexie.sync.js',
'src/ngdexie.ui.js'
],
testUtils: [
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "ngDexie",
"version": "0.0.13",
"version": "0.0.14",
"description": "Angularjs wrapper around Dexie.js an IndexedDB handler",
"keywords": [
"angular",
Expand Down
86 changes: 0 additions & 86 deletions src/ngdexie.sync.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/ngdexie.utils.js
Expand Up @@ -39,13 +39,10 @@
* @returns {Function}
*/
function debounce(func, wait, immediate) {
console.log("debounce 1");
var timeout;
return function () {
console.log("debounce 2");
var context = this, args = arguments;
var later = function () {
console.log("debounce later");
timeout = null;
if (!immediate) {
func.apply(context, args);
Expand Down

0 comments on commit 86c46e5

Please sign in to comment.