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

@cheprasov/web-animation

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cheprasov/web-animation - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

package.json
{
"name": "@cheprasov/web-animation",
"version": "0.1.5",
"version": "0.1.6",
"author": "Alexander Cheprasov",

@@ -5,0 +5,0 @@ "description": "A Class for driving animated content on the web is based on requestAnimationFrame for performance.",

@@ -40,2 +40,4 @@ //@flow

_isInLoop: boolean = false;
constructor(options: OptionsType = {}) {

@@ -81,3 +83,6 @@ const opts = { ...defaultOptions, ...options };

this._rAF(this._onTick);
if (!this._isInLoop) {
this._rAF(this._onTick);
this._isInLoop = true;
}
}

@@ -101,2 +106,3 @@

if (this._isStopped) {
this._isInLoop = false;
return;

@@ -115,2 +121,3 @@ }

}
this._isInLoop = false;
return;

@@ -117,0 +124,0 @@ }

@@ -191,5 +191,14 @@ // @flow

it('should call tick function for animation', () => {
it('should call tick function for animation and mark as in loop', () => {
expect(animation._rAF).toHaveBeenCalledWith(animation._onTick);
expect(animation._isInLoop).toBeTruthy();
});
it('should not call tick animation if it is in loop', () => {
animation = new WebAnimation();
animation._rAF = jest.fn();
animation._isInLoop = true;
animation.run();
expect(animation._rAF).not.toHaveBeenCalled();
});
});

@@ -277,2 +286,3 @@

animation._isStopped = false;
animation._isInLoop = true;
progress = {

@@ -295,2 +305,3 @@ elapsedTime: 42,

expect(animation._rAF).not.toHaveBeenCalled();
expect(animation._isInLoop).toBeFalsy();
});

@@ -312,2 +323,3 @@

expect(animation._isStopped).toBeTruthy();
expect(animation._isInLoop).toBeFalsy();
});

@@ -318,2 +330,3 @@

expect(animation._rAF).not.toHaveBeenCalled();
expect(animation._isInLoop).toBeFalsy();
});

@@ -326,2 +339,3 @@

expect(animation._isStopped).toBeFalsy();
expect(animation._isInLoop).toBeTruthy();
});

@@ -333,2 +347,3 @@

expect(animation._rAF).toHaveBeenCalled();
expect(animation._isInLoop).toBeTruthy();
});

@@ -335,0 +350,0 @@ });

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