Add certification page

This commit is contained in:
Berkeley Martinez
2015-10-02 11:47:36 -07:00
parent d9332e7d03
commit 8c48626f03
17 changed files with 415 additions and 82 deletions

View File

@@ -1,7 +1,9 @@
var Rx = require('rx');
var debug = require('debug')('freecc:rxUtils');
import Rx from 'rx';
import debugFactory from 'debug';
exports.saveInstance = function saveInstance(instance) {
const debug = debugFactory('freecc:rxUtils');
export function saveInstance(instance) {
return new Rx.Observable.create(function(observer) {
if (!instance || typeof instance.save !== 'function') {
debug('no instance or save method');
@@ -17,16 +19,15 @@ exports.saveInstance = function saveInstance(instance) {
observer.onCompleted();
});
});
};
}
// alias saveInstance
exports.saveUser = exports.saveInstance;
export const saveUser = saveInstance;
exports.observeQuery = exports.observableQueryFromModel =
function observableQueryFromModel(Model, method, query) {
return Rx.Observable.fromNodeCallback(Model[method], Model)(query);
};
export function observeQuery(Model, method, query) {
return Rx.Observable.fromNodeCallback(Model[method], Model)(query);
}
exports.observeMethod = function observeMethod(context, methodName) {
export function observeMethod(context, methodName) {
return Rx.Observable.fromNodeCallback(context[methodName], context);
};
}