-
Notifications
You must be signed in to change notification settings - Fork 289
/
art-source.js
42 lines (39 loc) · 1.26 KB
/
art-source.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function (root, factory){
if(typeof define === 'function' && define.amd){
// AMD. Register as an anonymous module.
define([], factory);
}else if (typeof module === 'object' && module.exports){
module.exports = factory();
}else{
// Browser globals (root is window)
root.AsciiArtSource = factory();
}
}(this, function(list){
var art;
var request = function(){
throw new Error('request not set!');
}
return {
define : function(definition){
return {
//todo: make non-collidable
name: definition.name || ('object_'+Math.floor(Math.random()*10000)),
search : definition.search || function(query, callback){
},
list : definition.list || function(path, callback){
},
fetch : definition.fetch || function(location, callback){
},
useRequest : definition.useRequest || function(instance){
request = instance;
}
}
},
link : function(artInstance){
art = artInstance;
},
request : function(requestInstance){
request = requestInstance;
}
};
}));