New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

polyfire-js

Package Overview
Dependencies
Maintainers
3
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polyfire-js - npm Package Compare versions

Comparing version 0.2.12 to 0.2.13

6

generate.js

@@ -206,3 +206,7 @@ "use strict";

_this.on("infos", function (data) {
resolve(data);
resolve({
result: data.result,
tokenUsage: data.token_usage,
ressources: data.ressources,
});
});

@@ -209,0 +213,0 @@ })];

2

package.json
{
"name": "polyfire-js",
"version": "0.2.12",
"version": "0.2.13",
"main": "index.js",

@@ -5,0 +5,0 @@ "types": "index.d.ts",

@@ -6,2 +6,3 @@ /// <reference types="node" />

audioCtx: AudioContext | null;
source: AudioBufferSourceNode | null;
constructor(data: Buffer);

@@ -11,2 +12,5 @@ getMp3Buffer(): Buffer;

play(): Promise<void>;
stop(): Promise<void>;
pause(): Promise<void>;
resume(): Promise<void>;
}

@@ -13,0 +17,0 @@ export declare function tts(text: string, { voice }?: {

@@ -69,2 +69,3 @@ "use strict";

this.data = data;
this.source = null;
this.data = data;

@@ -102,7 +103,7 @@ this.audioCtx = window ? new AudioContext() : null;

if (_this.audioCtx) {
var source = _this.audioCtx.createBufferSource();
source.buffer = buffer;
source.connect(_this.audioCtx.destination);
source.start();
source.onended = function () {
_this.source = _this.audioCtx.createBufferSource();
_this.source.buffer = buffer;
_this.source.connect(_this.audioCtx.destination);
_this.source.start();
_this.source.onended = function () {
resolve();

@@ -119,2 +120,47 @@ };

};
AudioTTS.prototype.stop = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
if (_this.audioCtx && _this.source) {
_this.source.stop();
_this.source.onended = function () {
resolve();
};
_this.source = null;
}
else {
reject(Error("AudioSource is not playing"));
}
})];
});
});
};
AudioTTS.prototype.pause = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (this.audioCtx && this.source) {
return [2 /*return*/, this.audioCtx.suspend()];
}
else {
throw Error("AudioSource is not playing");
}
return [2 /*return*/];
});
});
};
AudioTTS.prototype.resume = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (this.audioCtx && this.source) {
return [2 /*return*/, this.audioCtx.resume()];
}
else {
throw Error("AudioSource does not exist");
}
return [2 /*return*/];
});
});
};
return AudioTTS;

@@ -121,0 +167,0 @@ }());

Sorry, the diff of this file is not supported yet

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