forked from OHDSI/Atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
58 lines (46 loc) · 1.5 KB
/
utils.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
/*global define*/
define(
[
'jquery',
'knockout',
'jquery-ui',
],
function ($, ko) {
'use strict';
var match, uiVersion, createObject, register;
/*jslint regexp:true*/
match = ($.ui.version || '').match(/^(\d)\.(\d+)/);
/*jslint regexp:false*/
if (!match) {
uiVersion = null;
} else {
uiVersion = {
major: parseInt(match[1], 10),
minor: parseInt(match[2], 10)
};
}
createObject = Object.create || function (prototype) {
/// <summary>Simple (incomplete) shim for Object.create().</summary>
/// <param name='prototype' type='Object' mayBeNull='true'></param>
/// <returns type='Object'></returns>
function Type() { }
Type.prototype = prototype;
return new Type();
};
register = function (Constructor) {
/// <summary>Registers a binding.</summary>
/// <param name='Constructor' type='BindingHandler'>The binding handler's
/// constructor function.</param>
var handler = new Constructor();
ko.bindingHandlers[handler.widgetName] = {
init: handler.init.bind(handler),
update: handler.update.bind(handler)
};
};
return {
uiVersion: uiVersion,
createObject: createObject,
register: register
};
}
);