@@ -996,7 +996,7 @@ var CommentManager = (function() {
996996 this . runline = [ ] ;
997997 this . position = 0 ;
998998 this . limiter = 0 ;
999-
999+
10001000 this . factory = null ;
10011001 this . filter = null ;
10021002 this . csa = {
@@ -1134,7 +1134,7 @@ var CommentManager = (function() {
11341134 } ;
11351135
11361136 CommentManager . prototype . rescale = function ( ) {
1137-
1137+ // TODO: Implement rescaling
11381138 } ;
11391139
11401140 CommentManager . prototype . send = function ( data ) {
@@ -1423,13 +1423,13 @@ var CommentProvider = (function () {
14231423 /**
14241424 * Provider for HTTP content. This returns a promise that resolves to TEXT.
14251425 *
1426- * @param method - HTTP method to use
1427- * @param url - Base URL
1428- * @param responseType - type of response expected.
1429- * @param args - Arguments for query string. Note: This is only used when
1426+ * @param { string } method - HTTP method to use
1427+ * @param { string } url - Base URL
1428+ * @param { string } responseType - type of response expected.
1429+ * @param { Object } args - Arguments for query string. Note: This is only used when
14301430 * method is POST or PUT
1431- * @param body - Text body content. If not provided will omit a body
1432- * @return Promise that resolves or rejects based on the success or failure
1431+ * @param { any } body - Text body content. If not provided will omit a body
1432+ * @return { Promise } that resolves or rejects based on the success or failure
14331433 * of the request
14341434 **/
14351435 CommentProvider . BaseHttpProvider = function ( method , url , responseType , args , body ) {
@@ -1441,15 +1441,13 @@ var CommentProvider = (function () {
14411441 var argsArray = [ ] ;
14421442 for ( var key in args ) {
14431443 if ( args . hasOwnProperty ( key ) ) {
1444- argsArray . push ( encodeURIComponent ( key ) +
1444+ argsArray . push ( encodeURIComponent ( key ) +
14451445 '=' + encodeURIComponent ( args [ key ] ) ) ;
14461446 }
14471447 }
14481448 uri += argsArray . join ( '&' ) ;
14491449 }
14501450
1451- xhr . responseType = typeof responseType === "string" ?
1452- responseType : "" ;
14531451 xhr . onload = function ( ) {
14541452 if ( this . status >= 200 && this . status < 300 ) {
14551453 resolve ( this . response ) ;
@@ -1463,6 +1461,11 @@ var CommentProvider = (function () {
14631461 } ;
14641462
14651463 xhr . open ( method , uri ) ;
1464+
1465+ // Limit the response type based on input
1466+ xhr . responseType = typeof responseType === "string" ?
1467+ responseType : "" ;
1468+
14661469 if ( typeof body !== 'undefined' ) {
14671470 xhr . send ( body ) ;
14681471 } else {
@@ -1474,12 +1477,12 @@ var CommentProvider = (function () {
14741477 /**
14751478 * Provider for JSON content. This returns a promise that resolves to JSON.
14761479 *
1477- * @param method - HTTP method to use
1478- * @param url - Base URL
1479- * @param args - Arguments for query string. Note: This is only used when
1480+ * @param { string } method - HTTP method to use
1481+ * @param { string } url - Base URL
1482+ * @param { Object } args - Arguments for query string. Note: This is only used when
14801483 * method is POST or PUT
1481- * @param body - Text body content. If not provided will omit a body
1482- * @return Promise that resolves or rejects based on the success or failure
1484+ * @param { any } body - Text body content. If not provided will omit a body
1485+ * @return { Promise } that resolves or rejects based on the success or failure
14831486 * of the request
14841487 **/
14851488 CommentProvider . JSONProvider = function ( method , url , args , body ) {
@@ -1492,12 +1495,12 @@ var CommentProvider = (function () {
14921495 /**
14931496 * Provider for XML content. This returns a promise that resolves to Document.
14941497 *
1495- * @param method - HTTP method to use
1496- * @param url - Base URL
1497- * @param args - Arguments for query string. Note: This is only used when
1498+ * @param { string } method - HTTP method to use
1499+ * @param { string } url - Base URL
1500+ * @param { Object } args - Arguments for query string. Note: This is only used when
14981501 * method is POST or PUT
1499- * @param body - Text body content. If not provided will omit a body
1500- * @return Promise that resolves or rejects based on the success or failure
1502+ * @param { any } body - Text body content. If not provided will omit a body
1503+ * @return { Promise } that resolves or rejects based on the success or failure
15011504 * of the request
15021505 **/
15031506 CommentProvider . XMLProvider = function ( method , url , args , body ) {
@@ -1510,12 +1513,12 @@ var CommentProvider = (function () {
15101513 /**
15111514 * Provider for text content. This returns a promise that resolves to Text.
15121515 *
1513- * @param method - HTTP method to use
1514- * @param url - Base URL
1515- * @param args - Arguments for query string. Note: This is only used when
1516+ * @param { string } method - HTTP method to use
1517+ * @param { string } url - Base URL
1518+ * @param { Object } args - Arguments for query string. Note: This is only used when
15161519 * method is POST or PUT
1517- * @param body - Text body content. If not provided will omit a body
1518- * @return Promise that resolves or rejects based on the success or failure
1520+ * @param { any } body - Text body content. If not provided will omit a body
1521+ * @return { Promise } that resolves or rejects based on the success or failure
15191522 * of the request
15201523 **/
15211524 CommentProvider . TextProvider = function ( method , url , args , body ) {
@@ -1530,14 +1533,14 @@ var CommentProvider = (function () {
15301533 * NOTE: Multiple static sources will race to determine the initial comment
15311534 * list so it is imperative that they all parse to the SAME content.
15321535 *
1533- * @param source - Promise that resolves to one of the supported types
1534- * @param type - Type that the provider resolves to
1535- * @return this
1536+ * @param { Provider } source - Promise that resolves to one of the supported types
1537+ * @param { Type } type - Type that the provider resolves to
1538+ * @return { CommentProvider } this
15361539 **/
15371540 CommentProvider . prototype . addStaticSource = function ( source , type ) {
15381541 if ( this . _destroyed ) {
15391542 throw new Error (
1540- 'Comment provider has been destroyed, ' +
1543+ 'Comment provider has been destroyed, ' +
15411544 'cannot attach more sources.' ) ;
15421545 }
15431546 if ( ! ( type in this . _staticSources ) ) {
@@ -1551,14 +1554,14 @@ var CommentProvider = (function () {
15511554 * Attaches a dynamic source to the corresponding type
15521555 * NOTE: Multiple dynamic sources will collectively provide comment data.
15531556 *
1554- * @param source - Listenable that resolves to one of the supported types
1555- * @param type - Type that the provider resolves to
1556- * @return this
1557+ * @param { DynamicProvider } source - Listenable that resolves to one of the supported types
1558+ * @param { Type } type - Type that the provider resolves to
1559+ * @return { CommentProvider } this
15571560 **/
15581561 CommentProvider . prototype . addDynamicSource = function ( source , type ) {
15591562 if ( this . _destroyed ) {
15601563 throw new Error (
1561- 'Comment provider has been destroyed, ' +
1564+ 'Comment provider has been destroyed, ' +
15621565 'cannot attach more sources.' ) ;
15631566 }
15641567 if ( ! ( type in this . _dynamicSources ) ) {
@@ -1571,8 +1574,8 @@ var CommentProvider = (function () {
15711574 /**
15721575 * Attaches a target comment manager so that we can stream comments to it
15731576 *
1574- * @param commentManager - Comment Manager instance to attach to
1575- * @return this
1577+ * @param { CommentManager } commentManager - Comment Manager instance to attach to
1578+ * @return { CommentProvider } this
15761579 **/
15771580 CommentProvider . prototype . addTarget = function ( commentManager ) {
15781581 if ( this . _destroyed ) {
@@ -1592,14 +1595,14 @@ var CommentProvider = (function () {
15921595 * Adds a parser for an incoming data type. If multiple parsers are added,
15931596 * parsers added later take precedence.
15941597 *
1595- * @param parser - Parser spec compliant parser
1596- * @param type - Type that the provider resolves to
1597- * @return this
1598+ * @param { CommentParser } parser - Parser spec compliant parser
1599+ * @param { Type } type - Type that the provider resolves to
1600+ * @return { CommentProvider } this
15981601 **/
15991602 CommentProvider . prototype . addParser = function ( parser , type ) {
16001603 if ( this . _destroyed ) {
16011604 throw new Error (
1602- 'Comment provider has been destroyed, ' +
1605+ 'Comment provider has been destroyed, ' +
16031606 'cannot attach more parsers.' ) ;
16041607 }
16051608 if ( ! ( type in this . _parsers ) ) {
@@ -1656,9 +1659,9 @@ var CommentProvider = (function () {
16561659 } ;
16571660
16581661 /**
1659- * Reloads static comments
1662+ * (Re)loads static comments
16601663 *
1661- * @return Promise that is resolved when the static sources have been
1664+ * @return { Promise } that is resolved when the static sources have been
16621665 * loaded
16631666 */
16641667 CommentProvider . prototype . load = function ( ) {
@@ -1688,7 +1691,7 @@ var CommentProvider = (function () {
16881691 /**
16891692 * Commit the changes and boot up the provider
16901693 *
1691- * @return Promise that is resolved when all the static sources are loaded
1694+ * @return { Promise } that is resolved when all the static sources are loaded
16921695 * and all the dynamic sources are hooked up
16931696 **/
16941697 CommentProvider . prototype . start = function ( ) {
0 commit comments