diff --git a/examples/grab.js b/examples/grab.js index 52b2a66546..3a9ce9921d 100644 --- a/examples/grab.js +++ b/examples/grab.js @@ -14,14 +14,6 @@ var MAX_SOLID_ANGLE = 0.01; // objects that appear smaller than this can't be gr var ZERO_VEC3 = {x: 0, y: 0, z: 0}; var IDENTITY_QUAT = {x: 0, y: 0, z: 0, w: 0}; - -if (typeof String.prototype.startsWith != 'function') { - // see below for better implementation! - String.prototype.startsWith = function (str){ - return this.indexOf(str) === 0; - }; -} - function getTag() { return "grab-" + MyAvatar.sessionUUID; } diff --git a/examples/libraries/utils.js b/examples/libraries/utils.js index f6f635c73a..2ee9bdd5fb 100644 --- a/examples/libraries/utils.js +++ b/examples/libraries/utils.js @@ -179,3 +179,9 @@ pointInExtents = function(point, minPoint, maxPoint) { (point.y >= minPoint.y && point.y <= maxPoint.y) && (point.z >= minPoint.z && point.z <= maxPoint.z); } + +if (typeof String.prototype.startsWith != 'function') { + String.prototype.startsWith = function (str){ + return this.slice(0, str.length) == str; + }; +}