Socket
Socket
Sign inDemoInstall

noitajs

Package Overview
Dependencies
277
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

dist/noita.bundle.js

115

noita-dev.ts

@@ -21,2 +21,6 @@ import * as _ from "lodash";

constructor (options: sobject) {
// firs of all check if any callback has been set
// if one found then call it once the promise has finished
let args = Array.prototype.slice.call(arguments, 1);
let callback = Array.prototype.shift.call(args);
// prevent any extension on settings

@@ -27,7 +31,7 @@ Object.preventExtensions(this.settings);

// then start the scope
animate.prototype.start( this.settings );
animate.prototype.start( this.settings, callback );
}
/* starts the animation process */
start (settings) {
start (settings, callback = undefined) {
// check if this settings has any properties first

@@ -45,4 +49,35 @@ if ( _.isEmpty(settings.properties) || !_.isObject(settings.properties) ) {

// now affect the style into the element
styleString += ";transition: all " + settings.transition + " " + settings.duration + settings.timing;
// start the animation
elem.setAttribute('style', styleString);
elem.style.webkitTransition = "all " + settings.transition + " " + settings.duration + settings.timing;
// sleep for some time
let sleep = animate.prototype.await( animate.prototype.timing( settings.duration, settings.timing, "ms" ).time );
// fulfill the sleep promise
sleep.then(
function (value)
{
// call the complete function
if ( undefined == callback )
{
settings.complete.call(this, settings, null);
}
else if ( typeof callback === "function" )
{
callback.call(this, settings, null);
}
}
).catch(
function (error)
{
// call the complete function
if ( undefined == callback )
{
settings.complete.call(this, settings, error);
}
else if ( typeof callback === "function" )
{
callback.call(this, settings, error);
}
}
);
}

@@ -53,2 +88,76 @@ );

/* sleep promise es5 support */
await (duration:number) {
return new Promise( (resolve, reject) => window.setTimeout(() => {
// if the browser is IE then just return a catchable error
if ( navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/)) )
{
reject( new Error("You are using IE, this browser is not supported by Noita Animation prototype, please wait until a new version is out to fix the problem.") );
}
else
{
resolve();
}
}, duration) );
}
/* convert the time to the exact duration */
timing (duration:number, from:string, to:string) {
// convert ms to a chosen timing unit
let mstounit = (n, unit:string) => {
switch (unit) {
case "s":
n = Math.round(duration / 1000);
break;
case "m":
n = Math.round( (duration / 1000) / 60 );
break;
default:
break;
}
return n;
};
// convert s to unit
let stounit = (n, unit:string) => {
switch (unit) {
case "ms":
n = Math.round(duration * 1000);
break;
case "m":
n = Math.round(duration / 60);
break;
default:
break;
}
return n;
};
// convert m to unit
let mtounit = (n, unit:string) => {
switch (unit) {
case "ms":
n = Math.round( (duration * 60) * 1000 );
break;
case "s":
n = Math.round(duration * 60);
break;
default:
break;
}
return n;
};
// convert now the duration
if ( from === "ms" ) {
duration = mstounit(duration, to);
} else if ( from === "s" ) {
duration = stounit(duration, to);
} else if ( from === "m" ) {
duration = mtounit(duration, to);
}
return {time: duration, unit: to};
}
}

@@ -55,0 +164,0 @@

11

package.json
{
"name": "noitajs",
"version": "1.0.0",
"version": "1.0.1",
"description": "Gives a smooth animation to your website components",

@@ -8,3 +8,3 @@ "main": "noita.js",

"lodash": "^4.17.4",
"webpack": "^1.14.0"
"webpack": "^2.2.0"
},

@@ -14,3 +14,3 @@ "devDependencies": {

"amd-define-factory-patcher-loader": "^1.0.0",
"babel": "^6.5.2",
"babel-cli": "^6.22.2",
"babel-core": "^6.21.0",

@@ -23,3 +23,2 @@ "babel-loader": "^6.2.10",

"jquery": "^3.1.1",
"lodash": "^4.17.4",
"path": "^0.12.7",

@@ -29,3 +28,3 @@ "sizzle": "^2.3.3",

"typescript": "^2.1.4",
"webpack": "^1.14.0"
"webpack-dev-server": "^2.3.0"
},

@@ -48,3 +47,3 @@ "scripts": {

"author": "Jeffery Hussin",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -51,0 +50,0 @@ "url": "https://github.com/JefferyHus/noitajs/issues"

# noitajs
[![Build Status](https://travis-ci.org/JefferyHus/noitajs.svg?branch=1.0.1-alpha)](https://travis-ci.org/JefferyHus/noitajs) [![GitHub version](https://badge.fury.io/gh/JefferyHus%2Fnoitajs.svg)](https://badge.fury.io/gh/JefferyHus%2Fnoitajs) [![GitHub release](https://img.shields.io/badge/release-1.0.1--alpha-blue.svg)]
[![Build Status](https://travis-ci.org/JefferyHus/noitajs.svg?branch=1.0.1-alpha)](https://travis-ci.org/JefferyHus/noitajs) [![npm version](https://badge.fury.io/js/noitajs.svg)](https://badge.fury.io/js/noitajs) ![GitHub release](https://img.shields.io/badge/release-1.0.1--alpha-blue.svg)

@@ -5,0 +5,0 @@ Description

@@ -17,4 +17,4 @@ {

"exclude": [
"./node_modules", "CachedData", "GPUCache", "Local Storage", "User"
"./node_modules"
]
}

@@ -0,0 +0,0 @@ {

/// <reference path="modules/lodash/index.d.ts" />

@@ -7,28 +7,38 @@ {

entry: {
js: './noita-dev.ts'
noita: './noita-dev.ts'
},
output: {
path: './dist',
path: path.resolve(__dirname, './dist'),
library: 'noita',
filename: 'noita.js'
filename: '[name].bundle.js'
},
devServer: {
contentBase: path.join(__dirname, "./"),
compress: true,
port: 9000
},
module: {
loaders: [
{test: /\.ts$/, loader: 'babel-loader!ts-loader', exclude: [/node_modules/, /typings/]},
rules: [
{test: /\.ts$/, use: ['babel-loader','ts-loader'], exclude: [/node_modules/, /typings/]},
{test: /jquery[\\\/]src[\\\/]selector\.js$/, loader: 'amd-define-factory-patcher-loader'},
{test: /\.js$/, loader: 'babel-loader', query: {presets: ['es2015']}, exclude: [/node_modules/, /typings/]}
{test: /\.js$/, loader: 'babel-loader', options: {presets: ['es2015']}, exclude: [/node_modules/, /typings/]}
]
},
resolve: {
extensions: ['', '.js', '.ts']
extensions: ['.js', '.ts'],
enforceExtension: false
}/*,
devtool: "source-map",
plugins: [
new webpack.optimize.UglifyJsPlugin({
new UglifyJsPlugin({
compress: {
warnings: false
warnings: true
},
sourceMap: false
sourceMap: true
})
new webpack.LoaderOptionsPlugin({
minimize: true
})
]*/
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc