solidstate
Version:
An observable REST client for Javascript with a dramatically simple & fluent API.
36 lines (29 loc) • 1.04 kB
JavaScript
if (typeof define !== 'function') { var define = require('amdefine')(module); }
define([
'knockout',
'underscore',
'URIjs',
'when',
'zoetropic'
], function(ko, _, URI, when, z) {
'use strict';
var o = ko.observable,
u = ko.utils.unwrapObservable,
c = ko.computed,
w = function(v) { return ko.isObservable(v) ? v : o(v); };
// Link = { resolve: Collection -> Collection }
//
// The simplest sort of link is a URI, a pointer. However, even a
// URI may be relative, hence takes a "source" location as an
// implicit input. And much more complex links arise in
// efficiently moving from a _set_ of fetched models to another
// set of fetched models. Hence, a link is a function from a
// Collection to another Collection.
//
var Link = function(implementation) {
var self = _({}).extend(implementation);
self.filtered = function(filters) { return FilterLink(filters, self); };
return self;
};
return Link;
});