-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathTernApi.js
73 lines (55 loc) · 1.74 KB
/
TernApi.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* Ternific Copyright (c) 2014 Miguel Castillo.
*
* Licensed under MIT
*/
define(function(require /*, exports, module*/) {
"use strict";
var ternDemo = require("./TernDemo");
var defaults = {
filter : true, // Results will be pretty large if we don't filter stuff out
sort : true,
depths : true,
guess : true,
origins : false,
docs : false,
expandWordForward: false
};
function TernApi() {
ternDemo.setServer(this);
}
TernApi.prototype.loadSettings = function() {
throw new TypeError("Not implemented");
};
TernApi.prototype.addFile = function() {
throw new TypeError("Not implemented");
};
TernApi.prototype.clear = function() {
throw new TypeError("Not implemented");
};
TernApi.prototype.request = function() {
throw new TypeError("Not implemented");
};
TernApi.prototype.query = function() {
if (!ternDemo.getCurDoc()) {
throw new TypeError("No document is currently selected");
}
var ternRequest = ternDemo.buildRequest.apply((void 0), arguments);
ternRequest.query = $.extend({}, defaults, ternRequest.query);
return this.request(ternRequest);
};
TernApi.prototype.trackChange = function() {
ternDemo.trackChange.apply((void 0), arguments);
};
TernApi.prototype.buildRequest = function() {
return ternDemo.buildRequest.apply((void 0), arguments);
};
TernApi.prototype.setCurrentDocument = function(doc) {
ternDemo.setCurDoc(doc);
};
TernApi.prototype.setDocuments = function(docs) {
ternDemo.setDocs(docs);
};
TernApi.defaults = defaults;
return TernApi;
});