-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathNative.js
More file actions
23 lines (19 loc) · 693 Bytes
/
Native.js
File metadata and controls
23 lines (19 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Tracks a list of native functions that can be called from Pascal.
define(function () {
var Native = function () {
// List of NativeProcedure objects. The index within the array is the
// number passed to the "CSP" instruction.
this.nativeProcedures = [];
};
// Adds a native method, returning its index.
Native.prototype.add = function (nativeProcedure) {
var index = this.nativeProcedures.length;
this.nativeProcedures.push(nativeProcedure);
return index;
};
// Get a native method by index.
Native.prototype.get = function (index) {
return this.nativeProcedures[index];
};
return Native;
});