mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
Remove more namespaces from tests (#16029)
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"no-empty-interface": false,
|
||||
"no-namespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false
|
||||
}
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
namespace DagreD3Tests {
|
||||
const gDagre = new dagreD3.graphlib.Graph();
|
||||
const graph = gDagre.graph();
|
||||
const gDagre = new dagreD3.graphlib.Graph();
|
||||
const graph = gDagre.graph();
|
||||
|
||||
// has graph methods from dagre.d.ts
|
||||
graph.setNode("a", {});
|
||||
const num: number = 251 + graph.height + graph.width;
|
||||
const predecessors: { [vertex: string]: string[] } = {};
|
||||
const successors: { [vertex: string]: string[] } = {};
|
||||
// has graph methods from dagre.d.ts
|
||||
graph.setNode("a", {});
|
||||
const num: number = 251 + graph.height + graph.width;
|
||||
const predecessors: { [vertex: string]: string[] } = {};
|
||||
const successors: { [vertex: string]: string[] } = {};
|
||||
|
||||
predecessors["a"] = graph.predecessors("a");
|
||||
successors["a"] = graph.successors("a");
|
||||
graph.transition = (selection: d3.Selection<any>) => {
|
||||
return d3.transition();
|
||||
};
|
||||
predecessors["a"] = graph.predecessors("a");
|
||||
successors["a"] = graph.successors("a");
|
||||
graph.transition = (selection: d3.Selection<any>) => {
|
||||
return d3.transition();
|
||||
};
|
||||
|
||||
const render = new dagreD3.render();
|
||||
const svg = d3.select("svg");
|
||||
render.arrows()["arrowType"] = (parent: d3.Selection<any>, id: string, edge: dagre.Edge, type: string) => {};
|
||||
render(svg, graph);
|
||||
}
|
||||
const render = new dagreD3.render();
|
||||
const svg = d3.select("svg");
|
||||
render.arrows()["arrowType"] = (parent: d3.Selection<any>, id: string, edge: dagre.Edge, type: string) => {};
|
||||
render(svg, graph);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
namespace DagreTests {
|
||||
const gDagre = new dagre.graphlib.Graph();
|
||||
gDagre.setGraph({})
|
||||
.setDefaultEdgeLabel(() => {})
|
||||
.setNode("a", {})
|
||||
.setEdge("b", "c")
|
||||
.setEdge("c", "d", {class: "class"});
|
||||
const gDagre = new dagre.graphlib.Graph();
|
||||
gDagre.setGraph({})
|
||||
.setDefaultEdgeLabel(() => {})
|
||||
.setNode("a", {})
|
||||
.setEdge("b", "c")
|
||||
.setEdge("c", "d", {class: "class"});
|
||||
|
||||
dagre.layout(gDagre);
|
||||
}
|
||||
dagre.layout(gDagre);
|
||||
|
||||
@@ -25,7 +25,7 @@ class MyComponent extends Component<MyComponentProps, MyComponentState> {
|
||||
const MyStatelessComponent = (props: StatelessProps) => <span />;
|
||||
|
||||
// ShallowWrapper
|
||||
namespace ShallowWrapperTest {
|
||||
function ShallowWrapperTest() {
|
||||
let shallowWrapper: ShallowWrapper<MyComponentProps, MyComponentState> =
|
||||
shallow<MyComponentProps, MyComponentState>(<MyComponent stringProp="value"/>);
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace ShallowWrapperTest {
|
||||
}
|
||||
|
||||
// ReactWrapper
|
||||
namespace ReactWrapperTest {
|
||||
function ReactWrapperTest() {
|
||||
let reactWrapper: ReactWrapper<MyComponentProps, MyComponentState> =
|
||||
mount<MyComponentProps, MyComponentState>(<MyComponent stringProp="value"/>);
|
||||
|
||||
@@ -631,7 +631,7 @@ namespace ReactWrapperTest {
|
||||
}
|
||||
|
||||
// CheerioWrapper
|
||||
namespace CheerioWrapperTest {
|
||||
function CheerioWrapperTest() {
|
||||
const wrapper: Cheerio =
|
||||
shallow(<div />).render() ||
|
||||
mount(<div />).render();
|
||||
|
||||
@@ -1,6 +1 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"only-arrow-functions-2": false
|
||||
}
|
||||
}
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
import later = require("later");
|
||||
|
||||
namespace LaterTest_DefineSchedule {
|
||||
function LaterTest_DefineSchedule() {
|
||||
// define a new schedule
|
||||
const textSched = later.parse.text('at 10:15am every weekday');
|
||||
const cronSched = later.parse.cron('0 0/5 14,18 * * ?');
|
||||
@@ -19,7 +19,7 @@ namespace LaterTest_DefineSchedule {
|
||||
.on(3).month();
|
||||
}
|
||||
|
||||
namespace LaterTest_ConfigureTimezone {
|
||||
function LaterTest_ConfigureTimezone() {
|
||||
// set later to use UTC (the default)
|
||||
later.date.UTC();
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace LaterTest_ConfigureTimezone {
|
||||
later.date.localTime();
|
||||
}
|
||||
|
||||
namespace LaterTest_TimePeriods {
|
||||
export function second() {
|
||||
function LaterTest_TimePeriods() {
|
||||
function second() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.second.name;
|
||||
@@ -59,7 +59,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Fri, 22 Mar 2013 10:01:27 GMT'
|
||||
}
|
||||
|
||||
export function minute() {
|
||||
function minute() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.minute.name;
|
||||
@@ -90,7 +90,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Fri, 22 Mar 2013 09:27:59 GMT'
|
||||
}
|
||||
|
||||
export function hour() {
|
||||
function hour() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.hour.name;
|
||||
@@ -121,7 +121,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Thu, 21 Mar 2013 21:59:59 GMT'
|
||||
}
|
||||
|
||||
export function time() {
|
||||
function time() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.time.name;
|
||||
@@ -152,7 +152,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Fri, 22 Mar 2013 00:01:00 GMT'
|
||||
}
|
||||
|
||||
export function day() {
|
||||
function day() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.day.name;
|
||||
@@ -183,7 +183,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Sat, 02 Mar 2013 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export function day_of_week() {
|
||||
function day_of_week() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.dayOfWeek.name;
|
||||
@@ -214,7 +214,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Thu, 21 Mar 2013 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export function day_of_week_count() {
|
||||
function day_of_week_count() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.dayOfWeekCount.name;
|
||||
@@ -249,7 +249,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Thu, 14 Mar 2013 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export function day_of_year() {
|
||||
function day_of_year() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.dayOfYear.name;
|
||||
@@ -280,7 +280,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Wed, 13 Feb 2013 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export function week_of_month() {
|
||||
function week_of_month() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.weekOfMonth.name;
|
||||
@@ -311,7 +311,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Sat, 09 Mar 2013 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export function week_of_year() {
|
||||
function week_of_year() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.weekOfYear.name;
|
||||
@@ -342,7 +342,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Sun, 30 Dec 2012 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export function month() {
|
||||
function month() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.month.name;
|
||||
@@ -373,7 +373,7 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Thu, 28 Feb 2013 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export function year() {
|
||||
function year() {
|
||||
const d = new Date('2013-03-22T10:02:05Z');
|
||||
|
||||
later.year.name;
|
||||
@@ -404,11 +404,11 @@ namespace LaterTest_TimePeriods {
|
||||
// 'Mon, 31 Dec 2012 23:59:59 GMT'
|
||||
}
|
||||
|
||||
export interface PartOfDayLater extends later.Static {
|
||||
interface PartOfDayLater extends later.Static {
|
||||
partOfDay: later.TimePeriod;
|
||||
}
|
||||
|
||||
export function custom() {
|
||||
function custom() {
|
||||
const customLater = <PartOfDayLater> later;
|
||||
|
||||
customLater.partOfDay = {
|
||||
@@ -497,8 +497,8 @@ namespace LaterTest_TimePeriods {
|
||||
}
|
||||
}
|
||||
|
||||
namespace LaterTest_GenerateRecurences {
|
||||
export function on_method() {
|
||||
function LaterTest_GenerateRecurences() {
|
||||
function on_method() {
|
||||
// fires on the 2nd minute every hour
|
||||
later.parse.recur().on(2).minute();
|
||||
|
||||
@@ -509,27 +509,27 @@ namespace LaterTest_GenerateRecurences {
|
||||
later.parse.recur().on('08:00:00').time();
|
||||
}
|
||||
|
||||
export function first_method() {
|
||||
function first_method() {
|
||||
// fires on the 0th minute of every hour
|
||||
later.parse.recur().first().minute();
|
||||
}
|
||||
|
||||
export function last_method() {
|
||||
function last_method() {
|
||||
// fires on the last day of every month at 5am
|
||||
later.parse.recur().on(5).hour().last().dayOfMonth();
|
||||
}
|
||||
|
||||
export function onWeekend_method() {
|
||||
function onWeekend_method() {
|
||||
// fires on the 5th minute of every hour during Sat and Sun
|
||||
later.parse.recur().on(5).minute().onWeekend();
|
||||
}
|
||||
|
||||
export function onWeekday_method() {
|
||||
function onWeekday_method() {
|
||||
// fires on the 5th minute of every hour during Mon,Tues,Wed,Thur,Fri
|
||||
later.parse.recur().on(5).minute().onWeekday();
|
||||
}
|
||||
|
||||
export function every_method() {
|
||||
function every_method() {
|
||||
// fires on the 0th, 10th, 20th, 30th, 40th, and 50th min of every hour
|
||||
later.parse.recur().every(10).minute();
|
||||
|
||||
@@ -537,7 +537,7 @@ namespace LaterTest_GenerateRecurences {
|
||||
later.parse.recur().every(3).month();
|
||||
}
|
||||
|
||||
export function after_method() {
|
||||
function after_method() {
|
||||
// fires on the 55th, 56th, 57th, 58th, and 59th minute
|
||||
later.parse.recur().after(55).minute();
|
||||
|
||||
@@ -545,7 +545,7 @@ namespace LaterTest_GenerateRecurences {
|
||||
later.parse.recur().every(6).hour().after('09:00').time();
|
||||
}
|
||||
|
||||
export function before_method() {
|
||||
function before_method() {
|
||||
// fires on the first second of January and February
|
||||
later.parse.recur().before(3).month();
|
||||
|
||||
@@ -557,17 +557,17 @@ namespace LaterTest_GenerateRecurences {
|
||||
later.parse.recur().after(9).hour().before(18).hour();
|
||||
}
|
||||
|
||||
export function startingOn_method() {
|
||||
function startingOn_method() {
|
||||
// fires on the 10th, 25th, 40th, and 55th minute of every hour
|
||||
later.parse.recur().every(15).minute().startingOn(10);
|
||||
}
|
||||
|
||||
export function between_method() {
|
||||
function between_method() {
|
||||
// fires on the 10th, 25th, 40th minute of every hour
|
||||
later.parse.recur().every(15).minute().between(10, 40);
|
||||
}
|
||||
|
||||
export function and_method() {
|
||||
function and_method() {
|
||||
// fires every 2 hours on the first day of every month
|
||||
// and 8:00am and 8:00pm on the last day of every month
|
||||
const sched = later.parse.recur()
|
||||
@@ -576,7 +576,7 @@ namespace LaterTest_GenerateRecurences {
|
||||
.on(8, 20).hour().last().dayOfMonth();
|
||||
}
|
||||
|
||||
export function except_method() {
|
||||
function except_method() {
|
||||
// fires every minute of every hour except on multiples of 2 and 3
|
||||
const sched = later.parse.recur()
|
||||
.every().minute()
|
||||
@@ -587,7 +587,7 @@ namespace LaterTest_GenerateRecurences {
|
||||
}
|
||||
}
|
||||
|
||||
namespace LaterTest_CalculateOccurences {
|
||||
function LaterTest_CalculateOccurences() {
|
||||
// Initialise next variable.
|
||||
let next: Date[] = [];
|
||||
|
||||
@@ -602,7 +602,7 @@ namespace LaterTest_CalculateOccurences {
|
||||
next = later.schedule(cronSched).prev(1, new Date(2013, 2, 21));
|
||||
}
|
||||
|
||||
namespace LaterTest_ExecuteCodeUsingSchedule {
|
||||
function LaterTest_ExecuteCodeUsingSchedule() {
|
||||
// will fire every 5 minutes
|
||||
const textSched = later.parse.text('every 5 min');
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"no-empty-interface": false,
|
||||
"no-namespace": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"one-line": false,
|
||||
|
||||
@@ -1,429 +1,427 @@
|
||||
import Memcached = require('memcached');
|
||||
import assert = require('assert');
|
||||
|
||||
namespace main {
|
||||
function isString(expected?: string): void {
|
||||
if (expected !== undefined && typeof expected !== 'string') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isArray(expected?: any[]): void {
|
||||
if (expected !== undefined && !Array.isArray(expected)) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isNumber(expected?: number): void {
|
||||
if (expected !== undefined && typeof expected !== 'number') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isBoolean(expected?: boolean): void {
|
||||
if (expected !== undefined && typeof expected !== 'boolean') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isFunction(expected?: (...args: any[]) => void): void {
|
||||
if (expected !== undefined && typeof expected !== 'function') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isVoid(expected?: undefined): void {
|
||||
if (expected !== undefined) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
|
||||
namespace test_global_options {
|
||||
Memcached.config.maxKeySize = 250;
|
||||
Memcached.config.maxExpiration = 2592000;
|
||||
Memcached.config.maxValue = 1048576;
|
||||
Memcached.config.poolSize = 10;
|
||||
Memcached.config.algorithm = 'md5';
|
||||
Memcached.config.reconnect = 1000;
|
||||
Memcached.config.timeout = 100;
|
||||
Memcached.config.retries = 1;
|
||||
Memcached.config.failures = 5;
|
||||
Memcached.config.retry = 100;
|
||||
Memcached.config.remove = false;
|
||||
Memcached.config.failOverServers = undefined;
|
||||
Memcached.config.keyCompression = true;
|
||||
Memcached.config.idle = 5000;
|
||||
}
|
||||
|
||||
namespace test_constructor_with_string {
|
||||
const location = '127.0.0.1:11211';
|
||||
|
||||
const memcached = new Memcached(location);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
namespace test_constructor_with_array {
|
||||
const location = [
|
||||
'127.0.0.1:11211',
|
||||
'127.0.0.1:11212',
|
||||
'127.0.0.1:11213'
|
||||
];
|
||||
|
||||
const memcached = new Memcached(location);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
namespace test_constructor_with_object {
|
||||
const location = {
|
||||
'127.0.0.1:11211': 1,
|
||||
'127.0.0.1:11212': 2,
|
||||
'127.0.0.1:11213': 3
|
||||
};
|
||||
|
||||
const memcached = new Memcached(location);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
namespace test_constructor_with_options {
|
||||
const location = '127.0.0.1:11211';
|
||||
const options: Memcached.options = {
|
||||
maxKeySize: 250,
|
||||
maxExpiration: 2592000,
|
||||
maxValue: 1048576,
|
||||
poolSize: 10,
|
||||
algorithm: 'md5',
|
||||
reconnect: 18000000,
|
||||
timeout: 5000,
|
||||
retries: 5,
|
||||
failures: 5,
|
||||
retry: 30000,
|
||||
remove: false,
|
||||
failOverServers: undefined,
|
||||
keyCompression: true,
|
||||
idle: 5000,
|
||||
};
|
||||
|
||||
const memcached = new Memcached(location, options);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
const memcached = new Memcached('127.0.0.1:11211');
|
||||
|
||||
namespace test_events {
|
||||
function isIssue(expected: Memcached.IssueData) {
|
||||
isString(expected.server);
|
||||
isArray(expected.tokens);
|
||||
isArray(expected.messages);
|
||||
isNumber(expected.failures);
|
||||
isNumber(expected.totalFailures);
|
||||
isNumber(expected.totalReconnectsAttempted);
|
||||
isNumber(expected.totalReconnectsSuccess);
|
||||
isNumber(expected.totalReconnectsFailed);
|
||||
isNumber(expected.totalDownTime);
|
||||
}
|
||||
memcached.on('issue', isIssue);
|
||||
memcached.on('failure', isIssue);
|
||||
memcached.on('reconnecting', isIssue);
|
||||
memcached.on('reconnect', isIssue);
|
||||
memcached.on('remove', isIssue);
|
||||
}
|
||||
|
||||
function isCommandData(expected: Memcached.CommandData) {
|
||||
isNumber(expected.start);
|
||||
isNumber(expected.execution);
|
||||
isFunction(expected.callback);
|
||||
isString(expected.type);
|
||||
isString(expected.command);
|
||||
isArray(expected.validate);
|
||||
isBoolean(expected.redundancyEnabled);
|
||||
isString(expected.key);
|
||||
isNumber(expected.lifetime);
|
||||
isString(expected.cas);
|
||||
}
|
||||
namespace test_set {
|
||||
memcached.set('key', 'value', 3600, function(err) {
|
||||
isCommandData(this);
|
||||
});
|
||||
}
|
||||
namespace test_touch {
|
||||
memcached.touch('key', 3600, function(err) {
|
||||
isCommandData(this);
|
||||
});
|
||||
}
|
||||
namespace test_get {
|
||||
memcached.get('key', function(err, data) {
|
||||
isCommandData(this);
|
||||
});
|
||||
}
|
||||
namespace test_getMulti {
|
||||
memcached.getMulti(['foo', 'bar'], function(err, data) {
|
||||
isVoid(this);
|
||||
assert(typeof data, 'object');
|
||||
});
|
||||
}
|
||||
namespace test_cas {
|
||||
const promises = [];
|
||||
const key = 'caskey';
|
||||
const value = 'casvalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, function() {
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.gets(key, function(err, data) {
|
||||
isCommandData(this);
|
||||
memcached.cas(key, value, data.cas, 0, function(err, result) {
|
||||
isCommandData(this);
|
||||
assert(result);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.cas(key, value, '99', 0, function(err, result) {
|
||||
isCommandData(this);
|
||||
assert(!result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
|
||||
namespace test_replace {
|
||||
const promises = [];
|
||||
const key = 'replacekey';
|
||||
const value = 'replacevalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, () => {
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.replace(key, value, 0, function(err, result) {
|
||||
assert(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.replace('noexistss', value, 0, function(err, result) {
|
||||
assert(!result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
namespace test_add {
|
||||
const promises = [];
|
||||
const key = 'addkey';
|
||||
const value = 'addvalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.add(key, value, 0, function(err, result) {
|
||||
assert(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.add(key, value, 0, function(err, result) {
|
||||
assert(!result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
namespace test_append {
|
||||
const promises = [];
|
||||
const key = 'appendkey';
|
||||
const value = 'appendvalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.append(key, value, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
namespace test_prepend {
|
||||
const promises = [];
|
||||
const key = 'prependkey';
|
||||
const value = 'prependvalue';
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.prepend(key, value, function(err, result) {
|
||||
isBoolean(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
namespace test_incr {
|
||||
const promises = [];
|
||||
const key = 'incrkey';
|
||||
const value = 2;
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.incr(key, value, function(err, result) {
|
||||
assert.deepStrictEqual(result, 4);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.incr('noexists', value, function(err, result) {
|
||||
assert.deepStrictEqual(result, false);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
namespace test_decr {
|
||||
const promises = [];
|
||||
const key = 'decrkey';
|
||||
const value = 2;
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, function(err, result) {
|
||||
isCommandData(this);
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.decr(key, value, function(err, result) {
|
||||
assert.deepStrictEqual(result, 0);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.decr('noexists', value, function(err, result) {
|
||||
assert.deepStrictEqual(result, false);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
namespace test_decr {
|
||||
const promises = [];
|
||||
const key = 'delkey';
|
||||
const value = 'delvalue';
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.del(key, function(err, result) {
|
||||
isBoolean(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
|
||||
namespace test_version {
|
||||
memcached.version((err, data) => {
|
||||
for (const version of data) {
|
||||
isString(version.server);
|
||||
isString(version.version);
|
||||
isString(version.major);
|
||||
isString(version.minor);
|
||||
isString(version.bugfix);
|
||||
}
|
||||
});
|
||||
}
|
||||
namespace test_stats {
|
||||
memcached.stats((err: any, data: Memcached.StatusData[]) => {
|
||||
isArray(data);
|
||||
for (const stat of data) {
|
||||
isString(stat.server);
|
||||
}
|
||||
});
|
||||
}
|
||||
namespace test_settings {
|
||||
memcached.settings((err: any, data: Memcached.StatusData[]) => {
|
||||
isArray(data);
|
||||
for (const setting of data) {
|
||||
isString(setting.server);
|
||||
}
|
||||
});
|
||||
}
|
||||
namespace test_slabs {
|
||||
memcached.slabs((err: any, data: Memcached.StatusData[]) => {
|
||||
isArray(data);
|
||||
for (const setting of data) {
|
||||
isString(setting.server);
|
||||
}
|
||||
});
|
||||
}
|
||||
let promise: Promise<any>;
|
||||
namespace test_items {
|
||||
promise = new Promise(resolve => {
|
||||
memcached.items((err, data) => {
|
||||
isArray(data);
|
||||
for (const setting of data) {
|
||||
isString(setting.server);
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
namespace test_cachedump {
|
||||
promise.then(data => {
|
||||
for (const node of data) {
|
||||
const server = node.server;
|
||||
delete node.server;
|
||||
Object.keys(node).forEach(slabid => {
|
||||
memcached.cachedump(server, Number(slabid), node[slabid].number, (err, data) => {
|
||||
if (!Array.isArray(data)) data = [data];
|
||||
data.forEach(cache => {
|
||||
isNumber(cache.b);
|
||||
isNumber(cache.s);
|
||||
isString(cache.key);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
namespace test_flush {
|
||||
memcached.flush(function(err, results) {
|
||||
isVoid(this);
|
||||
isArray(results);
|
||||
});
|
||||
function isString(expected?: string): void {
|
||||
if (expected !== undefined && typeof expected !== 'string') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isArray(expected?: any[]): void {
|
||||
if (expected !== undefined && !Array.isArray(expected)) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isNumber(expected?: number): void {
|
||||
if (expected !== undefined && typeof expected !== 'number') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isBoolean(expected?: boolean): void {
|
||||
if (expected !== undefined && typeof expected !== 'boolean') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isFunction(expected?: (...args: any[]) => void): void {
|
||||
if (expected !== undefined && typeof expected !== 'function') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
function isVoid(expected?: undefined): void {
|
||||
if (expected !== undefined) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
|
||||
function test_global_options() {
|
||||
Memcached.config.maxKeySize = 250;
|
||||
Memcached.config.maxExpiration = 2592000;
|
||||
Memcached.config.maxValue = 1048576;
|
||||
Memcached.config.poolSize = 10;
|
||||
Memcached.config.algorithm = 'md5';
|
||||
Memcached.config.reconnect = 1000;
|
||||
Memcached.config.timeout = 100;
|
||||
Memcached.config.retries = 1;
|
||||
Memcached.config.failures = 5;
|
||||
Memcached.config.retry = 100;
|
||||
Memcached.config.remove = false;
|
||||
Memcached.config.failOverServers = undefined;
|
||||
Memcached.config.keyCompression = true;
|
||||
Memcached.config.idle = 5000;
|
||||
}
|
||||
|
||||
function test_constructor_with_string() {
|
||||
const location = '127.0.0.1:11211';
|
||||
|
||||
const memcached = new Memcached(location);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
function test_constructor_with_array() {
|
||||
const location = [
|
||||
'127.0.0.1:11211',
|
||||
'127.0.0.1:11212',
|
||||
'127.0.0.1:11213'
|
||||
];
|
||||
|
||||
const memcached = new Memcached(location);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
function test_constructor_with_object() {
|
||||
const location = {
|
||||
'127.0.0.1:11211': 1,
|
||||
'127.0.0.1:11212': 2,
|
||||
'127.0.0.1:11213': 3
|
||||
};
|
||||
|
||||
const memcached = new Memcached(location);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
function test_constructor_with_options() {
|
||||
const location = '127.0.0.1:11211';
|
||||
const options: Memcached.options = {
|
||||
maxKeySize: 250,
|
||||
maxExpiration: 2592000,
|
||||
maxValue: 1048576,
|
||||
poolSize: 10,
|
||||
algorithm: 'md5',
|
||||
reconnect: 18000000,
|
||||
timeout: 5000,
|
||||
retries: 5,
|
||||
failures: 5,
|
||||
retry: 30000,
|
||||
remove: false,
|
||||
failOverServers: undefined,
|
||||
keyCompression: true,
|
||||
idle: 5000,
|
||||
};
|
||||
|
||||
const memcached = new Memcached(location, options);
|
||||
memcached.end();
|
||||
}
|
||||
|
||||
const memcached = new Memcached('127.0.0.1:11211');
|
||||
|
||||
function test_events() {
|
||||
function isIssue(expected: Memcached.IssueData) {
|
||||
isString(expected.server);
|
||||
isArray(expected.tokens);
|
||||
isArray(expected.messages);
|
||||
isNumber(expected.failures);
|
||||
isNumber(expected.totalFailures);
|
||||
isNumber(expected.totalReconnectsAttempted);
|
||||
isNumber(expected.totalReconnectsSuccess);
|
||||
isNumber(expected.totalReconnectsFailed);
|
||||
isNumber(expected.totalDownTime);
|
||||
}
|
||||
memcached.on('issue', isIssue);
|
||||
memcached.on('failure', isIssue);
|
||||
memcached.on('reconnecting', isIssue);
|
||||
memcached.on('reconnect', isIssue);
|
||||
memcached.on('remove', isIssue);
|
||||
}
|
||||
|
||||
function isCommandData(expected: Memcached.CommandData) {
|
||||
isNumber(expected.start);
|
||||
isNumber(expected.execution);
|
||||
isFunction(expected.callback);
|
||||
isString(expected.type);
|
||||
isString(expected.command);
|
||||
isArray(expected.validate);
|
||||
isBoolean(expected.redundancyEnabled);
|
||||
isString(expected.key);
|
||||
isNumber(expected.lifetime);
|
||||
isString(expected.cas);
|
||||
}
|
||||
function test_set() {
|
||||
memcached.set('key', 'value', 3600, function(err) {
|
||||
isCommandData(this);
|
||||
});
|
||||
}
|
||||
function test_touch() {
|
||||
memcached.touch('key', 3600, function(err) {
|
||||
isCommandData(this);
|
||||
});
|
||||
}
|
||||
function test_get() {
|
||||
memcached.get('key', function(err, data) {
|
||||
isCommandData(this);
|
||||
});
|
||||
}
|
||||
function test_getMulti() {
|
||||
memcached.getMulti(['foo', 'bar'], function(err, data) {
|
||||
isVoid(this);
|
||||
assert(typeof data, 'object');
|
||||
});
|
||||
}
|
||||
function test_cas() {
|
||||
const promises = [];
|
||||
const key = 'caskey';
|
||||
const value = 'casvalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, function() {
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.gets(key, function(err, data) {
|
||||
isCommandData(this);
|
||||
memcached.cas(key, value, data.cas, 0, function(err, result) {
|
||||
isCommandData(this);
|
||||
assert(result);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.cas(key, value, '99', 0, function(err, result) {
|
||||
isCommandData(this);
|
||||
assert(!result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
|
||||
function test_replace() {
|
||||
const promises = [];
|
||||
const key = 'replacekey';
|
||||
const value = 'replacevalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, () => {
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.replace(key, value, 0, function(err, result) {
|
||||
assert(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.replace('noexistss', value, 0, function(err, result) {
|
||||
assert(!result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
function test_add() {
|
||||
const promises = [];
|
||||
const key = 'addkey';
|
||||
const value = 'addvalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.add(key, value, 0, function(err, result) {
|
||||
assert(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.add(key, value, 0, function(err, result) {
|
||||
assert(!result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
function test_append() {
|
||||
const promises = [];
|
||||
const key = 'appendkey';
|
||||
const value = 'appendvalue';
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.append(key, value, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
function test_prepend() {
|
||||
const promises = [];
|
||||
const key = 'prependkey';
|
||||
const value = 'prependvalue';
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.prepend(key, value, function(err, result) {
|
||||
isBoolean(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
function test_incr() {
|
||||
const promises = [];
|
||||
const key = 'incrkey';
|
||||
const value = 2;
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.incr(key, value, function(err, result) {
|
||||
assert.deepStrictEqual(result, 4);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.incr('noexists', value, function(err, result) {
|
||||
assert.deepStrictEqual(result, false);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
function test_decr() {
|
||||
const promises = [];
|
||||
const key = 'decrkey';
|
||||
const value = 2;
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, function(err, result) {
|
||||
isCommandData(this);
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.decr(key, value, function(err, result) {
|
||||
assert.deepStrictEqual(result, 0);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.decr('noexists', value, function(err, result) {
|
||||
assert.deepStrictEqual(result, false);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
function test_decr_2() {
|
||||
const promises = [];
|
||||
const key = 'delkey';
|
||||
const value = 'delvalue';
|
||||
Promise.resolve()
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.set(key, value, 0, (err, result) => {
|
||||
isBoolean(result);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
.then(() => new Promise(resolve => {
|
||||
memcached.del(key, function(err, result) {
|
||||
isBoolean(result);
|
||||
isCommandData(this);
|
||||
resolve();
|
||||
});
|
||||
}))
|
||||
;
|
||||
}
|
||||
|
||||
function test_version() {
|
||||
memcached.version((err, data) => {
|
||||
for (const version of data) {
|
||||
isString(version.server);
|
||||
isString(version.version);
|
||||
isString(version.major);
|
||||
isString(version.minor);
|
||||
isString(version.bugfix);
|
||||
}
|
||||
});
|
||||
}
|
||||
function test_stats() {
|
||||
memcached.stats((err: any, data: Memcached.StatusData[]) => {
|
||||
isArray(data);
|
||||
for (const stat of data) {
|
||||
isString(stat.server);
|
||||
}
|
||||
});
|
||||
}
|
||||
function test_settings() {
|
||||
memcached.settings((err: any, data: Memcached.StatusData[]) => {
|
||||
isArray(data);
|
||||
for (const setting of data) {
|
||||
isString(setting.server);
|
||||
}
|
||||
});
|
||||
}
|
||||
function test_slabs() {
|
||||
memcached.slabs((err: any, data: Memcached.StatusData[]) => {
|
||||
isArray(data);
|
||||
for (const setting of data) {
|
||||
isString(setting.server);
|
||||
}
|
||||
});
|
||||
}
|
||||
let promise: Promise<any>;
|
||||
function test_items() {
|
||||
promise = new Promise(resolve => {
|
||||
memcached.items((err, data) => {
|
||||
isArray(data);
|
||||
for (const setting of data) {
|
||||
isString(setting.server);
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
function test_cachedump() {
|
||||
promise.then(data => {
|
||||
for (const node of data) {
|
||||
const server = node.server;
|
||||
delete node.server;
|
||||
Object.keys(node).forEach(slabid => {
|
||||
memcached.cachedump(server, Number(slabid), node[slabid].number, (err, data) => {
|
||||
if (!Array.isArray(data)) data = [data];
|
||||
data.forEach(cache => {
|
||||
isNumber(cache.b);
|
||||
isNumber(cache.s);
|
||||
isString(cache.key);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_flush() {
|
||||
memcached.flush(function(err, results) {
|
||||
isVoid(this);
|
||||
isArray(results);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-empty-interface": false,
|
||||
"no-internal-module": false,
|
||||
"no-namespace": false,
|
||||
"no-padding": false,
|
||||
"no-string-throw": false,
|
||||
"no-var": false,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-empty-interface": false,
|
||||
"no-internal-module": false,
|
||||
"no-namespace": false,
|
||||
"no-padding": false,
|
||||
"no-string-throw": false,
|
||||
"no-var": false,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-empty-interface": false,
|
||||
"no-internal-module": false,
|
||||
"no-namespace": false,
|
||||
"no-padding": false,
|
||||
"no-string-throw": false,
|
||||
"no-var": false,
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-empty-interface": false,
|
||||
"no-internal-module": false,
|
||||
"no-namespace": false,
|
||||
"no-padding": false,
|
||||
"no-string-throw": false,
|
||||
"no-var": false,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace basics {
|
||||
export class Basics {
|
||||
function basics() {
|
||||
class Basics {
|
||||
private app: PIXI.Application;
|
||||
|
||||
private bunny: PIXI.Sprite;
|
||||
@@ -20,7 +20,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class Click {
|
||||
class Click {
|
||||
private app: PIXI.Application;
|
||||
|
||||
private sprite: PIXI.Sprite;
|
||||
@@ -44,7 +44,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class ContainerPivot {
|
||||
class ContainerPivot {
|
||||
private app: PIXI.Application;
|
||||
private container: PIXI.Container;
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class Container {
|
||||
class Container {
|
||||
private app: PIXI.Application;
|
||||
private container: PIXI.Container;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class CustomizedFilter extends PIXI.Filter {
|
||||
class CustomizedFilter extends PIXI.Filter {
|
||||
constructor(fragmentSource: string) {
|
||||
super(null, fragmentSource, {
|
||||
customUniform: {
|
||||
@@ -113,7 +113,7 @@ namespace basics {
|
||||
});
|
||||
}
|
||||
}
|
||||
export class CustomFilter {
|
||||
class CustomFilter {
|
||||
private app: PIXI.Application;
|
||||
private background: PIXI.Sprite;
|
||||
private filter: CustomizedFilter;
|
||||
@@ -142,7 +142,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class Graphics {
|
||||
class Graphics {
|
||||
private app: PIXI.Application;
|
||||
private graphics: PIXI.Graphics;
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class RenderTexture {
|
||||
class RenderTexture {
|
||||
private app: PIXI.Application;
|
||||
private container: PIXI.Container;
|
||||
private renderTexture: PIXI.RenderTexture;
|
||||
@@ -226,7 +226,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class SpriteSheet {
|
||||
class SpriteSheet {
|
||||
private app: PIXI.Application;
|
||||
private anim: PIXI.extras.AnimatedSprite;
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class Text {
|
||||
class Text {
|
||||
private app: PIXI.Application;
|
||||
private basicText: PIXI.Text;
|
||||
private richText: PIXI.Text;
|
||||
@@ -297,7 +297,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class TexturedMesh {
|
||||
class TexturedMesh {
|
||||
private app: PIXI.Application;
|
||||
private count: number;
|
||||
private points: PIXI.Point[];
|
||||
@@ -351,7 +351,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class TilingSprite {
|
||||
class TilingSprite {
|
||||
private app: PIXI.Application;
|
||||
private tilingSprite: PIXI.extras.TilingSprite;
|
||||
private count: number;
|
||||
@@ -382,7 +382,7 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
export class Video {
|
||||
class Video {
|
||||
private app: PIXI.Application;
|
||||
private button: PIXI.Graphics;
|
||||
private videoSprite: PIXI.Sprite;
|
||||
@@ -425,8 +425,8 @@ namespace basics {
|
||||
}
|
||||
}
|
||||
|
||||
namespace demos {
|
||||
export class AlphaMask {
|
||||
function demos() {
|
||||
class AlphaMask {
|
||||
private app: PIXI.Application;
|
||||
private bg: PIXI.Container;
|
||||
private cells: PIXI.Sprite;
|
||||
@@ -473,7 +473,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class AnimatedSpriteDemo {
|
||||
class AnimatedSpriteDemo {
|
||||
private app: PIXI.Application;
|
||||
|
||||
constructor() {
|
||||
@@ -508,7 +508,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class Batch {
|
||||
class Batch {
|
||||
private app: PIXI.Application;
|
||||
private sprites: PIXI.particles.ParticleContainer;
|
||||
private maggots: Dude[];
|
||||
@@ -586,7 +586,7 @@ namespace demos {
|
||||
});
|
||||
}
|
||||
}
|
||||
export class Dude extends PIXI.Sprite {
|
||||
class Dude extends PIXI.Sprite {
|
||||
direction: number = 0;
|
||||
speed: number = 0;
|
||||
turningSpeed: number = 0;
|
||||
@@ -597,7 +597,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class BlendModes {
|
||||
class BlendModes {
|
||||
private app: PIXI.Application;
|
||||
private background: PIXI.Sprite;
|
||||
private dudeArray: Dude[];
|
||||
@@ -662,7 +662,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class CacheAsBitmap {
|
||||
class CacheAsBitmap {
|
||||
private app: PIXI.Application;
|
||||
private aliens: PIXI.Sprite[];
|
||||
private count: number;
|
||||
@@ -727,7 +727,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class Dragging {
|
||||
class Dragging {
|
||||
private app: PIXI.Application;
|
||||
private data: PIXI.interaction.InteractionData;
|
||||
private dragging: boolean;
|
||||
@@ -785,7 +785,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class GraphicsDemo {
|
||||
class GraphicsDemo {
|
||||
private app: PIXI.Application;
|
||||
private graphics: PIXI.Graphics;
|
||||
private thing: PIXI.Graphics;
|
||||
@@ -872,7 +872,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class Interactivity {
|
||||
class Interactivity {
|
||||
private app: PIXI.Application;
|
||||
private background: PIXI.Sprite;
|
||||
private buttons: PIXI.Sprite[];
|
||||
@@ -938,7 +938,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class Masking {
|
||||
class Masking {
|
||||
private app: PIXI.Application;
|
||||
private bg: PIXI.Sprite;
|
||||
private container: PIXI.Container;
|
||||
@@ -1026,7 +1026,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class RenderTextureDemo {
|
||||
class RenderTextureDemo {
|
||||
private app: PIXI.Application;
|
||||
|
||||
private renderTexture: PIXI.RenderTexture;
|
||||
@@ -1110,7 +1110,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class StripDemo {
|
||||
class StripDemo {
|
||||
private app: PIXI.Application;
|
||||
private count: number;
|
||||
private points: PIXI.Point[];
|
||||
@@ -1151,7 +1151,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class TextDemo {
|
||||
class TextDemo {
|
||||
private app: PIXI.Application;
|
||||
private bitmapFontText: PIXI.extras.BitmapText;
|
||||
private background: PIXI.Sprite;
|
||||
@@ -1227,7 +1227,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class TextureRotate {
|
||||
class TextureRotate {
|
||||
private app: PIXI.Application;
|
||||
private bol: boolean;
|
||||
private texture: PIXI.Texture;
|
||||
@@ -1288,7 +1288,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class TextureSwap {
|
||||
class TextureSwap {
|
||||
private app: PIXI.Application;
|
||||
private bol: boolean;
|
||||
private texture: PIXI.Texture;
|
||||
@@ -1328,7 +1328,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class Tinting {
|
||||
class Tinting {
|
||||
private app: PIXI.Application;
|
||||
private aliens: Dude[];
|
||||
|
||||
@@ -1386,7 +1386,7 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
export class TransparentBackground {
|
||||
class TransparentBackground {
|
||||
private app: PIXI.Application;
|
||||
private bunny: PIXI.Sprite;
|
||||
|
||||
@@ -1410,8 +1410,8 @@ namespace demos {
|
||||
}
|
||||
}
|
||||
|
||||
namespace filters {
|
||||
export class BlurFilter {
|
||||
function filters() {
|
||||
class BlurFilter {
|
||||
private app: PIXI.Application;
|
||||
private bg: PIXI.Sprite;
|
||||
private littleDudes: PIXI.Sprite;
|
||||
@@ -1459,7 +1459,7 @@ namespace filters {
|
||||
}
|
||||
}
|
||||
|
||||
export class DisplacementMap {
|
||||
class DisplacementMap {
|
||||
private app: PIXI.Application;
|
||||
private container: PIXI.Container;
|
||||
private maggots: DisplacementMapDude[];
|
||||
@@ -1563,7 +1563,7 @@ namespace filters {
|
||||
this.ring.y = eventData.data.global.y;
|
||||
}
|
||||
}
|
||||
export class DisplacementMapDude extends PIXI.Sprite {
|
||||
class DisplacementMapDude extends PIXI.Sprite {
|
||||
direction: number = 0;
|
||||
speed: number = 0;
|
||||
turnSpeed: number = 0;
|
||||
@@ -1574,7 +1574,7 @@ namespace filters {
|
||||
}
|
||||
}
|
||||
|
||||
export class Filter {
|
||||
class Filter {
|
||||
private app: PIXI.Application;
|
||||
private bg: PIXI.Sprite;
|
||||
private filter: PIXI.filters.ColorMatrixFilter;
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-namespace": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +1,61 @@
|
||||
import * as Rx from 'rx-lite';
|
||||
|
||||
namespace Tests.Async {
|
||||
let obsNum: Rx.Observable<number>;
|
||||
let obsStr: Rx.Observable<string>;
|
||||
let obsNum: Rx.Observable<number>;
|
||||
let obsStr: Rx.Observable<string>;
|
||||
|
||||
function fromCallback() {
|
||||
// 0 arguments
|
||||
const func0: (cb: (result: number) => void) => void = () => { };
|
||||
obsNum = Rx.Observable.fromCallback(func0)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr, (results: number[]) => results[0])();
|
||||
function fromCallback() {
|
||||
// 0 arguments
|
||||
const func0: (cb: (result: number) => void) => void = () => { };
|
||||
obsNum = Rx.Observable.fromCallback(func0)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr, (results: number[]) => results[0])();
|
||||
|
||||
// 1 argument
|
||||
const func1: (a: string, cb: (result: number) => void) => number = () => 0;
|
||||
obsNum = Rx.Observable.fromCallback(func1)("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {})("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {}, (results: number[]) => results[0])("");
|
||||
// 1 argument
|
||||
const func1: (a: string, cb: (result: number) => void) => number = () => 0;
|
||||
obsNum = Rx.Observable.fromCallback(func1)("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {})("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {}, (results: number[]) => results[0])("");
|
||||
|
||||
// 2 arguments
|
||||
const func2: (a: number, b: string, cb: (result: string) => number) => Date = () => new Date();
|
||||
obsStr = Rx.Observable.fromCallback(func2)(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {})(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {}, (results: string[]) => results[0])(1, "");
|
||||
// 2 arguments
|
||||
const func2: (a: number, b: string, cb: (result: string) => number) => Date = () => new Date();
|
||||
obsStr = Rx.Observable.fromCallback(func2)(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {})(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {}, (results: string[]) => results[0])(1, "");
|
||||
|
||||
// 3 arguments
|
||||
const func3: (a: number, b: string, c: boolean, cb: (result: string) => number) => Date = () => new Date();
|
||||
obsStr = Rx.Observable.fromCallback(func3)(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {})(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {}, (results: string[]) => results[0])(1, "", true);
|
||||
// 3 arguments
|
||||
const func3: (a: number, b: string, c: boolean, cb: (result: string) => number) => Date = () => new Date();
|
||||
obsStr = Rx.Observable.fromCallback(func3)(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {})(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {}, (results: string[]) => results[0])(1, "", true);
|
||||
|
||||
// multiple results
|
||||
const func0m: (cb: (result1: number, result2: number, result3: number) => void) => void = () => { };
|
||||
obsNum = Rx.Observable.fromCallback(func0m, obsStr, (results: number[]) => results[0])();
|
||||
const func1m: (a: string, cb: (result1: number, result2: number, result3: number) => void) => void = () => { };
|
||||
obsNum = Rx.Observable.fromCallback(func1m, obsStr, (results: number[]) => results[0])("");
|
||||
const func2m: (a: string, b: number, cb: (result1: string, result2: string, result3: string) => void) => void = () => { };
|
||||
obsStr = Rx.Observable.fromCallback(func2m, obsStr, (results: string[]) => results[0])("", 10);
|
||||
}
|
||||
// multiple results
|
||||
const func0m: (cb: (result1: number, result2: number, result3: number) => void) => void = () => { };
|
||||
obsNum = Rx.Observable.fromCallback(func0m, obsStr, (results: number[]) => results[0])();
|
||||
const func1m: (a: string, cb: (result1: number, result2: number, result3: number) => void) => void = () => { };
|
||||
obsNum = Rx.Observable.fromCallback(func1m, obsStr, (results: number[]) => results[0])("");
|
||||
const func2m: (a: string, b: number, cb: (result1: string, result2: string, result3: string) => void) => void = () => { };
|
||||
obsStr = Rx.Observable.fromCallback(func2m, obsStr, (results: string[]) => results[0])("", 10);
|
||||
}
|
||||
|
||||
function toPromise() {
|
||||
const promiseImpl: {
|
||||
new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Rx.IPromise<T>;
|
||||
} = undefined as any;
|
||||
function toPromise() {
|
||||
const promiseImpl: {
|
||||
new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Rx.IPromise<T>;
|
||||
} = undefined as any;
|
||||
|
||||
Rx.config.Promise = promiseImpl;
|
||||
Rx.config.Promise = promiseImpl;
|
||||
|
||||
let p: Rx.IPromise<number> = obsNum.toPromise(promiseImpl);
|
||||
let p: Rx.IPromise<number> = obsNum.toPromise(promiseImpl);
|
||||
|
||||
p = obsNum.toPromise();
|
||||
p = obsNum.toPromise();
|
||||
|
||||
p = p.then(x => x);
|
||||
p = p.then(x => p);
|
||||
p = p.then(undefined, reason => 10);
|
||||
// p = p.then(undefined, reason => p);
|
||||
p = p.then(x => x);
|
||||
p = p.then(x => p);
|
||||
p = p.then(undefined, reason => 10);
|
||||
// p = p.then(undefined, reason => p);
|
||||
|
||||
let ps: Rx.IPromise<string> = p.then(undefined, reason => "error");
|
||||
ps = p.then(x => "");
|
||||
ps = p.then(x => ps);
|
||||
}
|
||||
let ps: Rx.IPromise<string> = p.then(undefined, reason => "error");
|
||||
ps = p.then(x => "");
|
||||
ps = p.then(x => ps);
|
||||
}
|
||||
|
||||
function test_scan() {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODOs
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false
|
||||
"max-line-length": false,
|
||||
"no-namespace": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,9 +618,7 @@ function loader(this: webpack.loader.LoaderContext, source: string, sourcemap: s
|
||||
this.callback(null, source);
|
||||
}
|
||||
|
||||
namespace loader {
|
||||
export const raw: boolean = true;
|
||||
export const pitch = (remainingRequest: string, precedingRequest: string, data: any) => {};
|
||||
}
|
||||
(loader as webpack.loader.Loader).raw = true;
|
||||
(loader as webpack.loader.Loader).pitch = (remainingRequest: string, precedingRequest: string, data: any) => {};
|
||||
const loaderRef: webpack.loader.Loader = loader;
|
||||
console.log(loaderRef.raw === true);
|
||||
|
||||
Reference in New Issue
Block a user