Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tmi.js

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tmi.js - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

12

index.js

@@ -0,3 +1,13 @@

// Provide support for < Chrome 41 mainly due to CLR Browser..
String.prototype.includes || (String.prototype.includes = function() {
return -1 !== String.prototype.indexOf.apply(this, arguments)
}), String.prototype.startsWith || (String.prototype.startsWith = function(a, b) {
return b = b || 0, this.indexOf(a, b) === b
}), Object.setPrototypeOf || (Object.setPrototypeOf = function(obj, proto) {
obj.__proto__ = proto;
return obj;
});
module.exports={
client:require("./lib/client")
};
};

@@ -17,2 +17,25 @@ var request = require("request");

}
// Inside an extension -> we cannot use jsonp!
else if (_.isExtension()) {
options = _.merge(options, { url: url, method: "GET", headers: {} })
// prepare request
var xhr = new XMLHttpRequest();
xhr.open(options.method, options.url, true);
for(var name in options.headers) {
xhr.setRequestHeader(name, options.headers[name]);
}
xhr.responseType = "json";
// set request handler
xhr.addEventListener("load", (ev) => {
if(xhr.readyState == 4) {
if(xhr.status != 200) {
callback(xhr.status, null, null);
} else {
callback(null, null, xhr.response);
}
}
});
// submit
xhr.send();
}
// Inside a web application, use jsonp..

@@ -19,0 +42,0 @@ else {

29

lib/client.js

@@ -21,2 +21,4 @@ var api = require("./api");

this.clientId = _.get(this.opts.options.clientId, null);
this.maxReconnectAttempts = _.get(this.opts.connection.maxReconnectAttempts, Infinity);

@@ -76,12 +78,2 @@ this.maxReconnectInterval = _.get(this.opts.connection.maxReconnectInterval, 30000);

// Provide support for < Chrome 41 mainly due to CLR Browser..
String.prototype.includes || (String.prototype.includes = function() {
return -1 !== String.prototype.indexOf.apply(this, arguments)
}), String.prototype.startsWith || (String.prototype.startsWith = function(a, b) {
return b = b || 0, this.indexOf(a, b) === b
}), Object.setPrototypeOf || (Object.setPrototypeOf = function(obj, proto) {
obj.__proto__ = proto;
return obj;
});
// Handle parsed chat server message..

@@ -509,3 +501,5 @@ client.prototype.handleMessage = function handleMessage(message) {

case "host_target_went_offline":
case "msg_censored_broadcaster":
case "msg_duplicate":
case "msg_emoteonly":
case "msg_verified_email":

@@ -795,5 +789,5 @@ case "msg_ratelimit":

}
else if (msg.includes("just subscribed")) {
this.emit("subscription", channel, msg.split(" ")[0]);
this.emit("subscription", channel, msg.split(" ")[0], { prime: msg.includes("Twitch Prime!") });
}

@@ -1083,9 +1077,14 @@ }

this.emotes = sets;
this.emit("emotesets", sets);
this.api({
url: `/chat/emoticon_images?emotesets=${sets}`,
headers: { "Authorization": `OAuth ${_.password(_.get(this.opts.identity.password, "")).replace("oauth:", "")}` }
headers: {
"Authorization": `OAuth ${_.password(_.get(this.opts.identity.password, "")).replace("oauth:", "")}`,
"Client-ID": this.clientId
}
}, (err, res, body) => {
if (!err) { return this.emotesets = body["emoticon_sets"] || {}; }
if (!err) {
this.emotesets = body["emoticon_sets"] || {};
return this.emit("emotesets", sets, this.emotesets);
}
setTimeout(() => { this._updateEmoteset(sets); }, 60000);

@@ -1092,0 +1091,0 @@ });

@@ -71,3 +71,3 @@ /*

var space = /\S+/g;
var regex = new RegExp(_.unescapeHtml(code));
var regex = new RegExp("(\\b|^|\s)"+_.unescapeHtml(code)+"(\\b|$|\s)");
var match;

@@ -74,0 +74,0 @@

@@ -6,3 +6,3 @@ var self = module.exports = {

// Value is a boolean..
isBoolean: (obj) => { return obj === true || obj === false || toString.call(obj) === "[object Boolean]"; },
isBoolean: (obj) => { return typeof(obj) === "boolean"; },

@@ -90,4 +90,7 @@ // Value is a finite number..

inherits: (ctor, superCtor) => {
ctor.super_ = superCtor;
Object.setPrototypeOf(ctor.prototype, superCtor.prototype);
ctor.super_ = superCtor
var TempCtor = function () {};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
},

@@ -105,2 +108,11 @@

isExtension: () => {
try {
if (window.chrome && chrome.runtime && chrome.runtime.id) { return true; }
return false;
} catch(e) {
return false;
}
},
// Merge two objects..

@@ -107,0 +119,0 @@ merge: (obj1, obj2) => {

{
"name": "tmi.js",
"version": "1.1.1",
"version": "1.1.2",
"description": "Javascript library for the Twitch Messaging Interface.",

@@ -56,3 +56,6 @@ "keywords": [

"dependencies": {
"request": "2.60.0",
"convert-source-map": "1.1.3",
"lru-cache": "4.0.1",
"punycode": "1.3.2",
"request": "2.74.0",
"ws": "1.0.1"

@@ -59,0 +62,0 @@ },

@@ -29,4 +29,4 @@ # tmi.js

~~~ html
<!--Sourcemap: //cdn.tmijs.org/js/1.1.0/tmi.js.map-->
<script src="//cdn.tmijs.org/js/1.1.1/tmi.min.js" integrity="sha384-8Q+qSu52Px9pRIc72XaZ9pFAFWO/bidhybR512f3TwwFKkdwyvF/lVKixrhp4u3h" crossorigin="anonymous"></script>
<!--Sourcemap: //cdn.tmijs.org/js/1.1.2/tmi.js.map-->
<script src="//cdn.tmijs.org/js/1.1.2/tmi.min.js" integrity="sha384-GONdkSqsv77zHY1cs3aAZoQJP/9wq2YBmES4prk2ZG1rUvrv3IKLFRbHqk/0CR1b" crossorigin="anonymous"></script>
~~~

@@ -52,14 +52,17 @@

- Schmoopiie - [https://github.com/Schmoopiie](https://github.com/Schmoopiie)
- AlcaDesign - [https://github.com/AlcaDesign](https://github.com/AlcaDesign)
- ben-eb - [https://github.com/ben-eb](https://github.com/ben-eb)
- AlcaDesign - [https://github.com/AlcaDesign](https://github.com/AlcaDesign)
- celluj34 - [https://github.com/celluj34](https://github.com/celluj34)
- d-4-ni - [https://github.com/d-4-ni](https://github.com/d-4-ni)
- subperks - [https://github.com/subperks](https://github.com/subperks)
- roberthartung - [https://github.com/roberthartung](https://github.com/roberthartung)
- Hatsuney - [https://github.com/Hatsuney](https://github.com/Hatsuney)
- UnwrittenFun - [https://github.com/UnwrittenFun](https://github.com/UnwrittenFun)
- Hatsuney - [https://github.com/Hatsuney](https://github.com/Hatsuney)
- Jonliney - [https://github.com/Jonliney](https://github.com/Jonliney)
- justinsacbibit - [https://github.com/justinsacbibit](https://github.com/justinsacbibit)
- joein3d - [https://github.com/joein3d](https://github.com/joein3d)
- mertzt89 - [https://github.com/mertzt89](https://github.com/mertzt89)
- artemisbot - [https://github.com/artemisbot](https://github.com/artemisbot)
- egonny - [https://github.com/egonny](https://github.com/egonny)
- smalls89 - [https://github.com/smalls89](https://github.com/smalls89)
- subperks - [https://github.com/subperks](https://github.com/subperks)
- mertzt89 - [https://github.com/mertzt89](https://github.com/mertzt89)
- joein3d - [https://github.com/joein3d](https://github.com/joein3d)

@@ -66,0 +69,0 @@ ## Contributing guidelines

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc