mirror of
https://github.com/FullScreenShenanigans/TimeHandlr.git
synced 2026-08-12 02:18:18 -07:00
(v0.7.0) Used shenanigans-manager@0.2 instead of Gulp
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "7"
|
||||
- "node"
|
||||
- "5"
|
||||
|
||||
script:
|
||||
node_modules/gulp/bin/gulp.js
|
||||
npm run verify
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"editor.tabSize": 4,
|
||||
"editor.trimAutoWhitespace": true,
|
||||
"tslint.alwaysShowRuleFailuresAsWarnings": true,
|
||||
"tslint.autoFixOnSave": true,
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
require("gulp-shenanigans").initialize(require("gulp"));
|
||||
Generated
+2
-8709
File diff suppressed because it is too large
Load Diff
+66
-28
@@ -1,29 +1,67 @@
|
||||
{
|
||||
"name": "timehandlr",
|
||||
"description": "A flexible, pausable alternative to setTimeout and setInterval.",
|
||||
"version": "0.6.1",
|
||||
"author": {
|
||||
"name": "Josh Goldberg",
|
||||
"email": "joshuakgoldberg@outlook.com"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:FullScreenShenanigans/TimeHandlr.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/FullScreenShenanigans/TimeHandlr/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-shenanigans": "^0.6.17"
|
||||
},
|
||||
"scripts": {
|
||||
"gulp": "gulp",
|
||||
"test": "gulp test"
|
||||
},
|
||||
"shenanigans": {
|
||||
"name": "TimeHandlr"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
"author": {
|
||||
"email": "joshuakgoldberg@outlook.com",
|
||||
"name": "Josh Goldberg"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/FullScreenShenanigans/TimeHandlr/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"description": "A flexible, pausable alternative to setTimeout and setInterval.",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.0.4",
|
||||
"@types/lolex": "^1.5.32",
|
||||
"@types/mocha": "^2.2.44",
|
||||
"@types/sinon": "^4.0.0",
|
||||
"@types/sinon-chai": "^2.7.29",
|
||||
"chai": "^4.1.2",
|
||||
"glob": "^7.1.2",
|
||||
"lolex": "^2.3.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha-headless-chrome": "^1.7.1",
|
||||
"requirejs": "^2.3.5",
|
||||
"run-for-every-file": "^1.1.0",
|
||||
"shenanigans-manager": "^0.2.0",
|
||||
"sinon": "^4.1.2",
|
||||
"sinon-chai": "^2.14.0",
|
||||
"tslint": "5.8.0",
|
||||
"typedoc": "^0.9.0",
|
||||
"typescript": "^2.6.2",
|
||||
"webpack": "^3.10.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"name": "timehandlr",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:FullScreenShenanigans/TimeHandlr.git"
|
||||
},
|
||||
"scripts": {
|
||||
"dist": "npm run dist:webpack",
|
||||
"dist:webpack": "webpack --config webpack.config.js",
|
||||
"docs": "npm run docs:typedoc",
|
||||
"docs:typedoc": "typedoc src/ --out docs/generated",
|
||||
"init": "npm install && npm run setup && npm run verify",
|
||||
"setup": "npm run setup:copy && npm run setup:package",
|
||||
"setup:copy": "npm run setup:copy:default",
|
||||
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files",
|
||||
"setup:package": "shenanigans-manager hydrate-package-json",
|
||||
"src": "npm run src:tsc && npm run src:tslint",
|
||||
"src:tsc": "tsc -p .",
|
||||
"src:tslint": "tslint -c tslint.json --exclude ./node_modules/**/*.ts* -p tsconfig.json -t stylish",
|
||||
"test": "npm run test:setup && npm run test:run",
|
||||
"test:run": "mocha-headless-chrome --file test/index.html",
|
||||
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
|
||||
"test:setup:copy": "npm run test:setup:copy:default",
|
||||
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files",
|
||||
"test:setup:html": "shenanigans-manager generate-test-html",
|
||||
"test:setup:tsc": "tsc -p test",
|
||||
"verify": "npm run src && npm run test && npm run dist && npm run docs",
|
||||
"watch": "run-p \"tsc -p . -w\" \"echo sup\""
|
||||
},
|
||||
"shenanigans": {
|
||||
"name": "TimeHandlr"
|
||||
},
|
||||
"types": "./src/index.d.ts",
|
||||
"version": "0.7.0"
|
||||
}
|
||||
+7
-40
@@ -54,9 +54,7 @@ export interface ITimeCycles {
|
||||
* @param args Any arguments, passed through a TimeHandlr.
|
||||
* @returns Anything truthy to stop repetition.
|
||||
*/
|
||||
export interface IEventCallback {
|
||||
(...args: any[]): any;
|
||||
}
|
||||
export type IEventCallback = (...args: any[]) => any;
|
||||
|
||||
/**
|
||||
* General-purpose calculator for numeric values.
|
||||
@@ -64,9 +62,7 @@ export interface IEventCallback {
|
||||
* @param args Any arguments.
|
||||
* @returns Some numeric value.
|
||||
*/
|
||||
export interface INumericCalculator {
|
||||
(...args: any[]): number;
|
||||
}
|
||||
export type INumericCalculator = (...args: any[]) => number;
|
||||
|
||||
/**
|
||||
* Calculator for event repetition.
|
||||
@@ -75,9 +71,7 @@ export interface INumericCalculator {
|
||||
* parent event's passed args.
|
||||
* @returns Whether an event should keep repeating.
|
||||
*/
|
||||
export interface IRepeatCalculator {
|
||||
(...args: any[]): boolean;
|
||||
}
|
||||
export type IRepeatCalculator = (...args: any[]) => boolean;
|
||||
|
||||
/**
|
||||
* Calculator for a class within a class cycle.
|
||||
@@ -85,9 +79,7 @@ export interface IRepeatCalculator {
|
||||
* @param args Any arguments.
|
||||
* @returns Either a className or a value for whether this should stop.
|
||||
*/
|
||||
export interface IClassCalculator {
|
||||
(thing: IThing, settings: ITimeCycle): string | boolean;
|
||||
}
|
||||
export type IClassCalculator = (thing: IThing, settings: ITimeCycle) => string | boolean;
|
||||
|
||||
/**
|
||||
* General-purpose Function to add or remove a class on a Thing.
|
||||
@@ -95,9 +87,7 @@ export interface IClassCalculator {
|
||||
* @param thing A Thing whose class is to change.
|
||||
* @param className The class to add or remove.
|
||||
*/
|
||||
export interface IClassChanger {
|
||||
(thing: IThing, className: string): void;
|
||||
}
|
||||
export type IClassChanger = (thing: IThing, className: string) => void;
|
||||
|
||||
/**
|
||||
* An object that may have classes added or removed, such as in a cycle.
|
||||
@@ -123,7 +113,7 @@ export interface IThing {
|
||||
/**
|
||||
* A callback for when this is added.
|
||||
*/
|
||||
onThingAdd?: (thing: IThing) => void;
|
||||
onThingAdd?(thing: IThing): void;
|
||||
|
||||
/**
|
||||
* Whether this is ready to have a visual display.
|
||||
@@ -143,7 +133,7 @@ export interface ITimeEvent {
|
||||
/**
|
||||
* Something to run when this event is triggered.
|
||||
*/
|
||||
callback: Function;
|
||||
callback(): void;
|
||||
|
||||
/**
|
||||
* Arguments to be passed to the callback.
|
||||
@@ -182,29 +172,6 @@ export interface ITimeHandlrSettings {
|
||||
*/
|
||||
timingDefault?: number;
|
||||
|
||||
/**
|
||||
* Attribute name to store listings of cycles in objects (by default,
|
||||
* "cycles").
|
||||
*/
|
||||
keyCycles?: string;
|
||||
|
||||
/**
|
||||
* Atribute name to store class name in objects (by default, "className").
|
||||
*/
|
||||
keyClassName?: string;
|
||||
|
||||
/**
|
||||
* Key to check for a callback before a cycle starts in objects (by default,
|
||||
* "onClassCycleStart").
|
||||
*/
|
||||
keyOnClassCycleStart?: string;
|
||||
|
||||
/**
|
||||
* Key to check for a callback after a cycle starts in objects (by default,
|
||||
* "doClassCycleStart").
|
||||
*/
|
||||
keyDoClassCycleStart?: string;
|
||||
|
||||
/**
|
||||
* Optional attribute to check for whether a cycle may be given to an
|
||||
* object (if not given, ignored).
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ export class TimeEvent implements ITimeEvent {
|
||||
/**
|
||||
* Something to run when this event is triggered.
|
||||
*/
|
||||
public callback: Function;
|
||||
public callback: () => void;
|
||||
|
||||
/**
|
||||
* Arguments to be passed to the callback.
|
||||
@@ -32,7 +32,7 @@ export class TimeEvent implements ITimeEvent {
|
||||
/**
|
||||
* How many times this has been called.
|
||||
*/
|
||||
public count: number = 0;
|
||||
public count = 0;
|
||||
|
||||
/**
|
||||
* Computes a value as either a raw Number or a Function.
|
||||
@@ -48,7 +48,7 @@ export class TimeEvent implements ITimeEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the Event class.
|
||||
* Initializes a new instance of the TimeEvent class.
|
||||
*
|
||||
* @param callback A callback to be run some number of times. If it returns
|
||||
* truthy, repetition stops.
|
||||
|
||||
+8
-39
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
IClassCalculator, IClassChanger, ICurrentEvents, IEventCallback, INumericCalculator,
|
||||
IThing, ITimeCycle, ITimeCycles, ITimeCycleSettings, ITimeEvent, ITimeHandlr, ITimeHandlrSettings
|
||||
IThing, ITimeCycle, ITimeCycles, ITimeCycleSettings, ITimeEvent, ITimeHandlr, ITimeHandlrSettings,
|
||||
} from "./ITimeHandlr";
|
||||
import { TimeEvent } from "./TimeEvent";
|
||||
|
||||
@@ -13,26 +13,6 @@ export class TimeHandlr implements ITimeHandlr {
|
||||
*/
|
||||
private readonly timingDefault: number;
|
||||
|
||||
/**
|
||||
* Attribute name to store listings of cycles in objects.
|
||||
*/
|
||||
private readonly keyCycles: string;
|
||||
|
||||
/**
|
||||
* Attribute name to store class name in objects.
|
||||
*/
|
||||
private readonly keyClassName: string;
|
||||
|
||||
/**
|
||||
* Key to check for a callback before a cycle starts in objects.
|
||||
*/
|
||||
private readonly keyOnClassCycleStart: string;
|
||||
|
||||
/**
|
||||
* Key to check for a callback after a cycle starts in objects.
|
||||
*/
|
||||
private readonly keyDoClassCycleStart: string;
|
||||
|
||||
/**
|
||||
* Optional attribute to check for whether a cycle may be given to an
|
||||
* object.
|
||||
@@ -75,10 +55,6 @@ export class TimeHandlr implements ITimeHandlr {
|
||||
|
||||
this.timingDefault = settings.timingDefault || 1;
|
||||
|
||||
this.keyCycles = settings.keyCycles || "cycles";
|
||||
this.keyClassName = settings.keyClassName || "className";
|
||||
this.keyOnClassCycleStart = settings.keyOnClassCycleStart || "onClassCycleStart";
|
||||
this.keyDoClassCycleStart = settings.keyDoClassCycleStart || "doClassCycleStart";
|
||||
this.keyCycleCheckValidity = settings.keyCycleCheckValidity;
|
||||
|
||||
this.copyCycleSettings = typeof settings.copyCycleSettings === "undefined" ? true : settings.copyCycleSettings;
|
||||
@@ -363,13 +339,9 @@ export class TimeHandlr implements ITimeHandlr {
|
||||
thing.onThingAdd = (): void => {
|
||||
const calcTime: number = settings.length * (timing as number);
|
||||
const entryDelay: number = Math.ceil(this.time / calcTime) * calcTime - this.time;
|
||||
let event: ITimeEvent;
|
||||
|
||||
if (entryDelay === 0) {
|
||||
event = this.addEventInterval(this.cycleClass, timing, Infinity, thing, settings);
|
||||
} else {
|
||||
event = this.addEvent(this.addEventInterval, entryDelay, this.cycleClass, timing, Infinity, thing, settings);
|
||||
}
|
||||
const event = entryDelay === 0
|
||||
? this.addEventInterval(this.cycleClass, timing, Infinity, thing, settings)
|
||||
: this.addEvent(this.addEventInterval, entryDelay, this.cycleClass, timing, Infinity, thing, settings);
|
||||
|
||||
settings.event = event;
|
||||
};
|
||||
@@ -416,12 +388,9 @@ export class TimeHandlr implements ITimeHandlr {
|
||||
return false;
|
||||
}
|
||||
|
||||
let name: string | boolean;
|
||||
if (current.constructor === Function) {
|
||||
name = (current as IClassCalculator)(thing, settings);
|
||||
} else {
|
||||
name = current as string;
|
||||
}
|
||||
const name = current.constructor === Function
|
||||
? (current as IClassCalculator)(thing, settings)
|
||||
: current;
|
||||
|
||||
settings.oldclass = settings.location;
|
||||
|
||||
@@ -473,7 +442,7 @@ export class TimeHandlr implements ITimeHandlr {
|
||||
* @param className The String to be added to the thing's class.
|
||||
*/
|
||||
private classAddGeneric(thing: IThing, className: string): void {
|
||||
thing.className += " " + className;
|
||||
thing.className += ` ${className}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./ITimeHandlr";
|
||||
export * from "./TimeEvent";
|
||||
export * from "./TimeHandlr";
|
||||
@@ -1,3 +0,0 @@
|
||||
import { mochaLoader } from "../main";
|
||||
|
||||
mochaLoader.it("_", (): void => { });
|
||||
+2
-17
@@ -1,19 +1,4 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
]
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { ITimeHandlr, ITimeHandlrSettings } from "../../src/ITimeHandlr";
|
||||
import { TimeHandlr } from "../../src/TimeHandlr";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export function mockTimeHandlr(settings: ITimeHandlrSettings): ITimeHandlr {
|
||||
return new TimeHandlr(settings);
|
||||
}
|
||||
+9
-3
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react",
|
||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
@@ -8,12 +10,16 @@
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"pretty": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
],
|
||||
"include": [
|
||||
"./src/**/*.ts"
|
||||
"./src/**/*.ts",
|
||||
"./src/**/*.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
+8
-52
@@ -1,56 +1,12 @@
|
||||
{
|
||||
"extends": "tslint:all",
|
||||
"extends": "./node_modules/shenanigans-manager/setup/tslint.json",
|
||||
"rules": {
|
||||
"array-type": [false],
|
||||
"arrow-return-shorthand": [false],
|
||||
"ban-types": [false],
|
||||
"callable-types": [false],
|
||||
"comment-format": [false],
|
||||
"completed-docs": [false],
|
||||
"cyclomatic-complexity": [false],
|
||||
"forin": [false],
|
||||
"linebreak-style": [false],
|
||||
"max-file-line-count": [false],
|
||||
"max-line-length": [true, 140],
|
||||
"member-ordering": [
|
||||
true,
|
||||
"public-before-private",
|
||||
"static-before-instance",
|
||||
"variables-before-functions"
|
||||
],
|
||||
"newline-before-return": [false],
|
||||
"no-any": [false],
|
||||
"no-bitwise": [false],
|
||||
"no-console": [false],
|
||||
"no-default-export": [false],
|
||||
"no-inferrable-types": [false],
|
||||
"no-magic-numbers": [false],
|
||||
"no-redundant-jsdoc": [false],
|
||||
"no-non-null-assertion": [false],
|
||||
"no-object-literal-type-assertion": [false],
|
||||
"no-submodule-imports": [false],
|
||||
"no-require-imports": false,
|
||||
"no-unbound-method": [false],
|
||||
"no-unsafe-any": [false],
|
||||
"no-unused-variable": [false],
|
||||
"no-void-expression": [false],
|
||||
"number-literal-format": [false],
|
||||
"object-literal-key-quotes": [false],
|
||||
"object-literal-shorthand": [false],
|
||||
"object-literal-sort-keys": [false],
|
||||
"only-arrow-functions": [false],
|
||||
"prefer-function-over-method": [false],
|
||||
"prefer-method-signature": [false],
|
||||
"prefer-switch": [false],
|
||||
"prefer-conditional-expression": [false],
|
||||
"prefer-template": [false],
|
||||
"restrict-plus-operands": [false],
|
||||
"space-before-function-paren": [false],
|
||||
"strict-boolean-expressions": [false],
|
||||
"strict-type-predicates": [false],
|
||||
"switch-final-break": [false],
|
||||
"trailing-comma": [false],
|
||||
"typedef": [false],
|
||||
"variable-name": [false]
|
||||
"completed-docs": false,
|
||||
"no-any": false,
|
||||
"no-non-null-assertion": false,
|
||||
"no-unbound-method": false,
|
||||
"no-unsafe-any": false,
|
||||
"prefer-function-over-method": false,
|
||||
"strict-boolean-expressions": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user