forked from metajack/strophejs
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split files up, strophe si now correctly wrapped
- Loading branch information
Showing
5 changed files
with
113 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
This program is distributed under the terms of the MIT license. | ||
Please see the LICENSE file for details. | ||
Copyright 2006-2008, OGG, LLC | ||
*/ | ||
|
||
/* jshint undef: true, unused: true:, noarg: true, latedef: true */ | ||
|
||
/** File: polyfills.js | ||
* A JavaScript library for XMPP BOSH/XMPP over Websocket. | ||
* | ||
* This file contains some polyfills used by strophe.js | ||
*/ | ||
|
||
/** PrivateFunction: Function.prototype.bind | ||
* Bind a function to an instance. | ||
* | ||
* This Function object extension method creates a bound method similar | ||
* to those in Python. This means that the 'this' object will point | ||
* to the instance you want. See | ||
* <a href='https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind'>MDC's bind() documentation</a> and | ||
* <a href='http://benjamin.smedbergs.us/blog/2007-01-03/bound-functions-and-function-imports-in-javascript/'>Bound Functions and Function Imports in JavaScript</a> | ||
* for a complete explanation. | ||
* | ||
* This extension already exists in some browsers (namely, Firefox 3), but | ||
* we provide it to support those that don't. | ||
* | ||
* Parameters: | ||
* (Object) obj - The object that will become 'this' in the bound function. | ||
* (Object) argN - An option argument that will be prepended to the | ||
* arguments given for the function call | ||
* | ||
* Returns: | ||
* The bound function. | ||
*/ | ||
if (!Function.prototype.bind) { | ||
Function.prototype.bind = function (obj /*, arg1, arg2, ... */) | ||
{ | ||
var func = this; | ||
var _slice = Array.prototype.slice; | ||
var _concat = Array.prototype.concat; | ||
var _args = _slice.call(arguments, 1); | ||
|
||
return function () { | ||
return func.apply(obj ? obj : this, | ||
_concat.call(_args, | ||
_slice.call(arguments, 0))); | ||
}; | ||
}; | ||
} | ||
|
||
/** PrivateFunction: Array.prototype.indexOf | ||
* Return the index of an object in an array. | ||
* | ||
* This function is not supplied by some JavaScript implementations, so | ||
* we provide it if it is missing. This code is from: | ||
* http://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:indexOf | ||
* | ||
* Parameters: | ||
* (Object) elt - The object to look for. | ||
* (Integer) from - The index from which to start looking. (optional). | ||
* | ||
* Returns: | ||
* The index of elt in the array or -1 if not found. | ||
*/ | ||
if (!Array.prototype.indexOf) | ||
{ | ||
Array.prototype.indexOf = function(elt /*, from*/) | ||
{ | ||
var len = this.length; | ||
|
||
var from = Number(arguments[1]) || 0; | ||
from = (from < 0) ? Math.ceil(from) : Math.floor(from); | ||
if (from < 0) { | ||
from += len; | ||
} | ||
|
||
for (; from < len; from++) { | ||
if (from in this && this[from] === elt) { | ||
return from; | ||
} | ||
} | ||
|
||
return -1; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* jshint ignore:start */ | ||
if (callback) { | ||
return callback(Strophe, $build, $msg, $iq, $pres); | ||
} | ||
|
||
|
||
})(function (Strophe, build, msg, iq, pres) { | ||
window.Strophe = Strophe; | ||
window.$build = build; | ||
window.$msg = msg; | ||
window.$iq = iq; | ||
window.$pres = pres; | ||
}); | ||
/* jshint ignore:end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* All of the Strophe globals are defined in this special function below so | ||
* that references to the globals become closures. This will ensure that | ||
* on page reload, these references will still be available to callbacks | ||
* that are still executing. | ||
*/ | ||
|
||
/* jshint ignore:start */ | ||
(function (callback) { | ||
/* jshint ignore:end */ |