Skip to content

Commit

Permalink
Convert externs to ES6.
Browse files Browse the repository at this point in the history
Issue shaka-project#1157

Change-Id: Ib8ddecc7106fea8c24c10cfac406c4709a3f275b
  • Loading branch information
theodab committed Jun 10, 2019
1 parent 94a47ec commit b805d15
Show file tree
Hide file tree
Showing 18 changed files with 1,071 additions and 1,243 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,13 @@ module.exports = {
'lib/debug/asserts.js',
],
},
{
'files': ['externs/*', 'externs/shaka/*'],
'rules': {
// Disable rules on useless constructors so we can use ES6 classes in
// externs.
'no-useless-constructor': 'off',
},
},
],
};
18 changes: 8 additions & 10 deletions externs/audiotrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,16 @@ AudioTrack.prototype.sourceBuffer;
* @extends {EventTarget}
* @interface
*/
function AudioTrackList() {}
class AudioTrackList {
/** @override */
addEventListener(type, listener, useCapture) {}

/** @override */
AudioTrackList.prototype.addEventListener =
function(type, listener, useCapture) {};
/** @override */
removeEventListener(type, listener, useCapture) {}

/** @override */
AudioTrackList.prototype.removeEventListener =
function(type, listener, useCapture) {};

/** @override */
AudioTrackList.prototype.dispatchEvent = function(event) {};
/** @override */
dispatchEvent(event) {}
}


/** @type {AudioTrackList} */
Expand Down
21 changes: 10 additions & 11 deletions externs/awesomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@
*/


/**
* @param {!Element} input
* @constructor
*/
const Awesomplete = function(input) {};

/** @type {!Array.<string>} */
Awesomplete.prototype.list;
class Awesomplete {
/** @param {!Element} input */
constructor(input) {
/** @type {!Array.<string>} */
this.list;

/** @type {number} */
Awesomplete.prototype.minChars;
/** @type {number} */
this.minChars;
}

Awesomplete.prototype.evaluate = function() {};
evaluate() {}
}
Loading

0 comments on commit b805d15

Please sign in to comment.