mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
THRIFT-1044 Fix JavaScript Inheritance
Patch: Henrique Mendonca git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1071370 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dd0c328a45
commit
55ea68f8e7
@ -42,9 +42,24 @@ var Thrift = {
|
||||
"CALL" : 1,
|
||||
"REPLY" : 2,
|
||||
"EXCEPTION" : 3
|
||||
},
|
||||
|
||||
objectLength : function(obj) {
|
||||
var length = 0
|
||||
for (k in obj)
|
||||
if (obj.hasOwnProperty(k))
|
||||
length++
|
||||
return length
|
||||
},
|
||||
|
||||
inherits : function(constructor, superConstructor) {
|
||||
function F(){} //Prototypal Inheritance http://javascript.crockford.com/prototypal.html
|
||||
F.prototype = superConstructor.prototype
|
||||
constructor.prototype = new F()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Thrift.TException = {}
|
||||
Thrift.TException.prototype = {
|
||||
initialize: function( message, code ) {
|
||||
@ -712,21 +727,3 @@ Thrift.Protocol.prototype = {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Thrift.objectLength = function(obj) {
|
||||
var length = 0;
|
||||
for (k in obj) {
|
||||
if (obj.hasOwnProperty(k)) {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
Thirft.inherits = function(constructor, superConstructor) {
|
||||
// Prototypal Inheritance
|
||||
// http://javascript.crockford.com/prototypal.html
|
||||
function F() {}
|
||||
F.prototype = superConstructor.prototype;
|
||||
constructor.prototype = new F();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user