Last active
October 14, 2015 01:18
-
-
Save ca0v/e56943756a7452060bea to your computer and use it in GitHub Desktop.
liferay/yui/alloyui typescript definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
create a class for every child namespace | |
create an typeof attribute to simulate an inner class. | |
*/ | |
var YUI: Liferay.YUI; | |
var Y = YUI(); | |
Y = YUI({ | |
debug: true, | |
combine: false | |
}); | |
Y.use('*', function (Y) { | |
// Y is a new YUI instance. | |
}); | |
Y.use('node', function (Y) { | |
// Y.Node is ready to use. | |
}); | |
YUI.add('davglass', | |
function (Y, name) { | |
Y[name] = function () { | |
Y.log('Dav was here!'); | |
}; | |
}, | |
'3.4.0', | |
{ | |
requires: ['harley-davidson', 'mt-dew'] | |
}); | |
YUI.applyConfig({ | |
modules: { | |
davglass: { | |
fullpath: './davglass.js' | |
} | |
} | |
}); | |
Y.io('/some/url', { | |
on: { | |
success: function (id, e) { | |
Y.log(e.responseText, "info", "src", true); | |
} | |
} | |
}); | |
YUI.use("promise", Y => { | |
var fulfilled = new Y.Promise(function (resolve) { | |
resolve('I am a fulfilled promise'); | |
}); | |
var rejected = new Y.Promise(function (resolve, reject) { | |
reject(new Error('I am a rejected promise')); | |
}); | |
Y.Promise.all([fulfilled, rejected]).then; | |
}); | |
YUI().use('event', function (Y) { | |
var button = Y.one("#readygo"); | |
button.on("click", e => e.target); | |
}); | |
var table = new Y.DataTable({ | |
columns: [ | |
{ type: 'checkbox', defaultChecked: true }, | |
{ key: 'firstName', sortable: true, resizable: true }, | |
{ key: 'lastName', sortable: true }, | |
{ key: 'role', formatter: () => { } } | |
], | |
data: { | |
source: 'http://myserver.com/service/json', | |
type: 'json', | |
schema: { | |
resultListLocator: 'results.users', | |
fields: [ | |
'username', | |
'firstName', | |
'lastName', | |
{ key: 'role', type: 'number' } | |
] | |
} | |
}, | |
recordType: {}, | |
pagedData: { | |
location: 'footer', | |
pageSizes: [20, 50, 'all'], | |
rowsPerPage: 20, | |
pageLinks: 5 | |
}, | |
editable: true | |
}); | |
YUI().use([], Y => { | |
var list = new Y.ModelList({ | |
items: [ | |
{ name: 'Model One', arbitraryData: 'foo' }, | |
{ name: 'Model Two', arbitraryData: 'bar' } | |
] | |
}); | |
var modelOne = new Y.Model({ name: 'Model One', arbitraryData: 'foo' }), | |
modelTwo = new Y.Model({ name: 'Model Two', arbitraryData: 'bar' }); | |
Y.dedupe; | |
Liferay.YUI.Array; | |
list.add([modelOne, modelTwo]); | |
}); | |
// TODO: test base | |
Y.sub; | |
Y.use; | |
// TODO: test Object methods | |
Y.owns; | |
Y.keys; | |
Y.size; | |
// TODO: test Array methods | |
Y.dedupe; | |
Y.hash; | |
Y.some; | |
Y.test; | |
// TODO: test Lang methods | |
Y.isNull; | |
Y._isNative; | |
Y.isArray; | |
Y.trimRight; | |
// TODO: test Log methods | |
Y.log; | |
Y.message; | |
// TODO: core | |
Y.getLocation; | |
// TODO: ua | |
Y.compareVersions; | |
// TODO: test later | |
Y.later; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************************************************/ | |
/* YUI is a function................YUI() */ | |
/* YUI is a namespace...............YUI.Widget */ | |
/* YUI is a class...................YUI.add */ | |
/***************************************************/ | |
declare namespace Liferay { | |
// Array class shadows the generic array class | |
type _ARRAY_ = Array<any>; | |
/***************************************************/ | |
/* YUI is a class...................YUI.add */ | |
/***************************************************/ | |
interface YUI { | |
/***************************************************/ | |
/* YUI is a function................YUI() */ | |
/***************************************************/ | |
(options?: { | |
debug: boolean; | |
combine: boolean; | |
}): YUI; | |
} | |
/** | |
* manually added | |
*/ | |
interface YUI { | |
ready(cb: () => void); | |
one(id: string): YUI.Node; | |
io(url: string, args: { | |
on: { | |
success: (code: number, data: any) => void | |
} | |
}): any; | |
} | |
/** | |
* mixins - YUI.Object is embedded..maybe others? | |
*/ | |
interface YUI extends YUI.Array, YUI.Lang, YUI.Log { | |
/** | |
* Returns `true` if the given function appears to be implemented in native code, | |
`false` otherwise. Will always return `false` -- even in ES5-capable browsers -- | |
if the `useNativeES5` YUI config option is set to `false`. | |
This isn't guaranteed to be 100% accurate and won't work for anything other than | |
functions, but it can be useful for determining whether a function like | |
`Array.prototype.forEach` is native or a JS shim provided by another library. | |
There's a great article by @kangax discussing certain flaws with this technique: | |
<http://perfectionkills.com/detecting-built-in-host-methods/> | |
While his points are valid, it's still possible to benefit from this function | |
as long as it's used carefully and sparingly, and in such a way that false | |
negatives have minimal consequences. It's used internally to avoid using | |
potentially broken non-native ES5 shims that have been added to the page by | |
other libraries. | |
*@param fn Function to test. | |
*@returns `true` if _fn_ appears to be native, `false` otherwise. | |
*/ | |
_isNative(fn: Function): Boolean; | |
/** | |
* Returns one of the following strings, representing the type of the item passed | |
in: "array" "boolean" "date" "error" "function" "null" "number" "object" "regexp" "string" "undefined" | |
Known issues: `typeof HTMLElementCollection` returns function in Safari, but | |
`Y.Lang.type()` reports "object", which could be a good thing -- | |
but it actually caused the logic in <code>Y.Lang.isObject</code> to fail. | |
*@param o the item to test. | |
*@returns the detected type. | |
*/ | |
type(o: any): string; | |
/** | |
* Returns a new object that uses _obj_ as its prototype. This method wraps the native ES5 `Object.create()` method if available, but doesn't currently pass through `Object.create()`'s second argument (properties) in order to ensure compatibility with older browsers. | |
*@param obj Prototype object. | |
*@returns New object using _obj_ as its prototype. | |
*/ | |
Object(obj: Object): Object; | |
/** | |
* Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or exists only on _obj_'s prototype. This is essentially a safer version of `obj.hasOwnProperty()`. | |
*@param obj Object to test. | |
*@param key Property name to look for. | |
*@returns `true` if _key_ exists on _obj_, `false` otherwise. | |
*/ | |
owns(obj: Object, key: String): Boolean; | |
/** | |
* Alias for `owns()`. | |
*@param obj Object to test. | |
*@param key Property name to look for. | |
*@returns `true` if _key_ exists on _obj_, `false` otherwise. | |
*/ | |
hasKey(obj: Object, key: String): Boolean; | |
/** | |
* Returns an array containing the object's enumerable keys. Does not include prototype keys or non-enumerable keys. Note that keys are returned in enumeration order (that is, in the same order that they would be enumerated by a `for-in` loop), which may not be the same as the order in which they were defined. This method is an alias for the native ES5 `Object.keys()` method if available. | |
*@param obj An object. | |
*@returns Array of keys. | |
*/ | |
keys(obj: Object): Array<String>[]; | |
/** | |
* Returns an array containing the values of the object's enumerable keys. Note that values are returned in enumeration order (that is, in the same order that they would be enumerated by a `for-in` loop), which may not be the same as the order in which they were defined. | |
*@param obj An object. | |
*@returns Array of values. | |
*/ | |
values(obj: Object): Array<any>; | |
/** | |
* Returns the number of enumerable keys owned by an object. | |
*@param obj An object. | |
*@returns The object's size. | |
*/ | |
size(obj: Object): Number; | |
/** | |
* Returns `true` if the object owns an enumerable property with the specified value. | |
*@param obj An object. | |
*@param value The value to search for. | |
*@returns `true` if _obj_ contains _value_, `false` otherwise. | |
*/ | |
hasValue(obj: Object, value: any): Boolean; | |
/** | |
* Executes a function on each enumerable property in _obj_. The function receives the value, the key, and the object itself as parameters (in that order). By default, only properties owned by _obj_ are enumerated. To include prototype properties, set the _proto_ parameter to `true`. | |
*@param obj Object to enumerate. | |
*@param fn Function to execute on each enumerable property. | |
*@param fn.value Value of the current property. | |
*@param fn.key Key of the current property. | |
*@param fn.obj Object being enumerated. | |
*@param thisObj `this` object to use when calling _fn_. | |
*@param proto Include prototype properties. | |
*@returns the YUI instance. | |
*/ | |
each(obj: Object, fn: (value: any, key: String, obj: Object) => void, thisObj?: Object, proto?: Boolean): YUI; | |
/** | |
* Executes a function on each enumerable property in _obj_, but halts if the function returns a truthy value. The function receives the value, the key, and the object itself as paramters (in that order). By default, only properties owned by _obj_ are enumerated. To include prototype properties, set the _proto_ parameter to `true`. | |
*@param obj Object to enumerate. | |
*@param fn Function to execute on each enumerable property. | |
*@param fn.value Value of the current property. | |
*@param fn.key Key of the current property. | |
*@param fn.obj Object being enumerated. | |
*@param thisObj `this` object to use when calling _fn_. | |
*@param proto Include prototype properties. | |
*@returns `true` if any execution of _fn_ returns a truthy value, `false` otherwise. | |
*/ | |
some(obj: Object, fn: (value: any, key: String, obj: Object) => void, thisObj?: Object, proto?: Boolean): Boolean; | |
/** | |
* Retrieves the sub value at the provided path, from the value object provided. | |
*@param o The object from which to extract the property value. | |
*@param path A path array, specifying the object traversal path from which to obtain the sub value. | |
*@returns The value stored in the path, undefined if not found, undefined if the source is not an object. Returns the source object if an empty path is provided. | |
*/ | |
getValue(o: any, path: Array<any>): any; | |
/** | |
* Sets the sub-attribute value at the provided path on the value object. Returns the modified value object, or undefined if the path is invalid. | |
*@param o The object on which to set the sub value. | |
*@param path A path array, specifying the object traversal path at which to set the sub value. | |
*@param val The new value for the sub-attribute. | |
*@returns The modified object, with the new sub value set, or undefined, if the path was invalid. | |
*/ | |
setValue(o: any, path: Array<any>, val: any): Object; | |
/** | |
* Returns `true` if the object has no enumerable properties of its own. | |
*@param obj An object. | |
*@returns `true` if the object is empty. | |
*/ | |
isEmpty(obj: Object): Boolean; | |
/** | |
* Static method on `YUI.Env` for parsing a UA string. Called at instantiation to populate `Y.UA`. | |
*@param subUA UA string to parse | |
*@returns The Y.UA object | |
*/ | |
parseUA(subUA?: String): Object; | |
/** | |
* Applies a configuration to all YUI instances in this execution context. | |
The main use case for this method is in "mashups" where several third-party | |
scripts need to write to a global YUI config, but cannot share a single | |
centrally-managed config object. This way they can all call | |
`YUI.applyConfig({})` instead of overwriting the single global config. | |
*@param o Configuration object to apply. | |
*/ | |
applyConfig(o: Object): void; | |
/** | |
* Set a method to be called when `Get.script` is called in Node.js `Get` will open the file, then pass it's content and it's path to this method before attaching it. Commonly used for code coverage instrumentation. <strong>Calling this multiple times will only attach the last hook method</strong>. This method is only available in Node.js. | |
*@param fn The function to set | |
*@param fn.data The content of the file | |
*@param fn.path The file path of the file | |
*/ | |
setLoadHook(fn: (data: String, path: String) => void): void; | |
/** | |
* Initialize the queue | |
*/ | |
_init(): void; | |
/** | |
* Get the next item in the queue. FIFO support | |
*@returns the next item in the queue. | |
*/ | |
next(): any; | |
/** | |
* Get the last in the queue. LIFO support. | |
*@returns the last item in the queue. | |
*/ | |
last(): any; | |
/** | |
* Add 0..n items to the end of the queue. | |
*@param add 0..n items. | |
*@returns this queue. | |
*/ | |
add(...args: any[]): Object; | |
/** | |
* Returns the current number of queued items. | |
*@returns The size. | |
*/ | |
size(): Number; | |
/** | |
* Returns a wrapper for a function which caches the return value of that function, | |
keyed off of the combined string representation of the argument values provided | |
when the wrapper is called. | |
Calling this function again with the same arguments will return the cached value | |
rather than executing the wrapped function. | |
Note that since the cache is keyed off of the string representation of arguments | |
passed to the wrapper function, arguments that aren't strings and don't provide | |
a meaningful `toString()` method may result in unexpected caching behavior. For | |
example, the objects `{}` and `{foo: 'bar'}` would both be converted to the | |
string `[object Object]` when used as a cache key. | |
*@param source The function to memoize. | |
*@param cache Object in which to store cached values. You may seed | |
this object with pre-existing cached values if desired. | |
*@param refetch If supplied, this value is compared with the cached value | |
using a `==` comparison. If the values are equal, the wrapped function is | |
executed again even though a cached value exists. | |
*@returns Wrapped function. | |
*/ | |
cached(source: Function, cache?: Object, refetch?: any): Function; | |
/** | |
* Returns the `location` object from the window/frame in which this YUI instance | |
operates, or `undefined` when executing in a non-browser environment | |
(e.g. Node.js). | |
It is _not_ recommended to hold references to the `window.location` object | |
outside of the scope of a function in which its properties are being accessed or | |
its methods are being called. This is because of a nasty bug/issue that exists | |
in both Safari and MobileSafari browsers: | |
[WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679). | |
*@returns The `location` object from the window/frame in which this YUI | |
instance operates. | |
*/ | |
getLocation(): Location; | |
/** | |
* Returns a new object containing all of the properties of all the supplied | |
objects. The properties from later objects will overwrite those in earlier | |
objects. | |
Passing in a single object will create a shallow copy of it. For a deep copy, | |
use `clone()`. | |
*@param merge One or more objects to merge. | |
*@returns A new merged object. | |
*/ | |
merge(...args: Object[]): Object; | |
/** | |
* Mixes _supplier_'s properties into _receiver_. | |
Properties on _receiver_ or _receiver_'s prototype will not be overwritten or | |
shadowed unless the _overwrite_ parameter is `true`, and will not be merged | |
unless the _merge_ parameter is `true`. | |
In the default mode (0), only properties the supplier owns are copied (prototype | |
properties are not copied). The following copying modes are available: `0`: _Default_. Object to object. `1`: Prototype to prototype. `2`: Prototype to prototype and object to object. `3`: Prototype to object. `4`: Object to prototype. | |
*@param receiver The object or function to receive the mixed | |
properties. | |
*@param supplier The object or function supplying the | |
properties to be mixed. | |
*@param overwrite If `true`, properties that already exist | |
on the receiver will be overwritten with properties from the supplier. | |
*@param whitelist An array of property names to copy. If | |
specified, only the whitelisted properties will be copied, and all others | |
will be ignored. | |
*@param mode Mix mode to use. See above for available modes. | |
*@param merge If `true`, objects and arrays that already | |
exist on the receiver will have the corresponding object/array from the | |
supplier merged into them, rather than being skipped or overwritten. When | |
both _overwrite_ and _merge_ are `true`, _merge_ takes precedence. | |
*@returns The receiver, or the YUI instance if the | |
specified receiver is falsy. | |
*/ | |
mix(receiver: Function | Object, supplier: Function | Object, overwrite?: Boolean, whitelist?: Array<String>[], mode?: Number, merge?: Boolean): Function | Object | YUI; | |
/** | |
* Executes the supplied function in the context of the supplied object 'when' milliseconds later. Executes the function a single time unless periodic is set to true. | |
*@param when the number of milliseconds to wait until the fn is executed. | |
*@param o the context object. | |
*@param fn the function to execute or the name of the method in the 'o' object to execute. | |
*@param data [Array] data that is provided to the function. This accepts either a single item or an array. If an array is provided, the function is executed with one parameter for each array item. If you need to pass a single array parameter, it needs to be wrapped in an array [myarray]. Note: native methods in IE may not have the call and apply methods. In this case, it will work, but you are limited to four arguments. | |
*@param periodic if true, executes continuously at supplied interval until canceled. | |
*@returns a timer object. Call the cancel() method on this object to stop the timer. | |
*/ | |
later(when: number, o: any, fn: Function | String, data: any, periodic: boolean): Object; | |
/** | |
* Performs a simple comparison between two version numbers, accounting for | |
standard versioning logic such as the fact that "535.8" is a lower version than | |
"535.24", even though a simple numerical comparison would indicate that it's | |
greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are | |
considered equivalent. | |
Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent, | |
1 if _a_ is higher than _b_. | |
Versions may be numbers or strings containing numbers and dots. For example, | |
both `535` and `"535.8.10"` are acceptable. A version string containing | |
non-numeric characters, like `"535.8.beta"`, may produce unexpected results. | |
*@param a First version number to compare. | |
*@param b Second version number to compare. | |
*@returns - 1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is | |
higher than _b_. | |
*/ | |
compareVersions(a: Number | String, b: Number | String): Number; | |
/** | |
* Applies a new configuration object to the config of this YUI instance. This | |
will merge new group/module definitions, and will also update the loader | |
cache if necessary. Updating `Y.config` directly will not update the cache. | |
*@param o the configuration object. | |
*/ | |
applyConfig(o: Object): void; | |
/** | |
* Executes the named method on the specified YUI instance if that method is | |
whitelisted. | |
*@param id YUI instance id. | |
*@param method Name of the method to execute. For example: | |
'Object.keys'. | |
*@param args Arguments to apply to the method. | |
*@returns Return value from the applied method, or `null` if the | |
specified instance was not found or the method was not whitelisted. | |
*/ | |
applyTo(id: String, method: String, args: Array<any>): any; | |
/** | |
* Registers a YUI module and makes it available for use in a `YUI().use()` call or | |
as a dependency for other modules. | |
The easiest way to create a first-class YUI module is to use | |
<a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build | |
tool. | |
Shifter will automatically wrap your module code in a `YUI.add()` call along | |
with any configuration info required for the module. | |
*@param name Module name. | |
*@param fn Function containing module code. This function will be | |
executed whenever the module is attached to a specific YUI instance. | |
*@param fn.Y The YUI instance to which this module is attached. | |
*@param fn.name Name of the module | |
*@param version Module version number. This is currently used only for | |
informational purposes, and is not used internally by YUI. | |
*@param config Module config. | |
*@param config.requires Array of other module names that must be | |
attached before this module can be attached. | |
*@param config.optional Array of optional module names that should | |
be attached before this module is attached if they've already been | |
loaded. If the `loadOptional` YUI option is `true`, optional modules | |
that have not yet been loaded will be loaded just as if they were hard | |
requirements. | |
*@param config.use Array of module names that are included within | |
or otherwise provided by this module, and which should be attached | |
automatically when this module is attached. This makes it possible to | |
create "virtual rollup" modules that simply attach a collection of other | |
modules or submodules. | |
*@returns This YUI instance. | |
*/ | |
add(name: String, fn: (Y: YUI, name: String) => void, version: String, config?: { requires?: Array<any>; optional?: Array<any>; use?: Array<any> }): YUI; | |
/** | |
* Attaches one or more modules to this YUI instance. When this is executed, | |
the requirements of the desired modules are analyzed, and one of several | |
things can happen: All required modules have already been loaded, and just need to be | |
attached to this YUI instance. In this case, the `use()` callback will | |
be executed synchronously after the modules are attached. One or more modules have not yet been loaded, or the Get utility is not | |
available, or the `bootstrap` config option is `false`. In this case, | |
a warning is issued indicating that modules are missing, but all | |
available modules will still be attached and the `use()` callback will | |
be executed synchronously. One or more modules are missing and the Loader is not available but the | |
Get utility is, and `bootstrap` is not `false`. In this case, the Get | |
utility will be used to load the Loader, and we will then proceed to | |
the following state: One or more modules are missing and the Loader is available. In this | |
case, the Loader will be used to resolve the dependency tree for the | |
missing modules and load them and their dependencies. When the Loader is | |
finished loading modules, the `use()` callback will be executed | |
asynchronously. | |
*@param use One or more module names to attach. | |
*@param callback Callback function to be executed once all | |
specified modules and their dependencies have been attached. | |
*@param callback.Y The YUI instance created for this sandbox. | |
*@param callback.status Object containing `success`, `msg` and | |
`data` properties. | |
*/ | |
use(args: String | String[], callback?: (Y: YUI, status: Object) => void): void; | |
/** | |
* Utility method for safely creating namespaces if they don't already exist. | |
May be called statically on the YUI global object or as a method on a YUI | |
instance. | |
When called statically, a namespace will be created on the YUI global | |
object: | |
// Create `YUI.your.namespace.here` as nested objects, preserving any | |
// objects that already exist instead of overwriting them. | |
YUI.namespace('your.namespace.here'); | |
When called as a method on a YUI instance, a namespace will be created on | |
that instance: | |
// Creates `Y.property.package`. | |
Y.namespace('property.package'); | |
Dots in the input string cause `namespace` to create nested objects for each | |
token. If any part of the requested namespace already exists, the current | |
object will be left in place and will not be overwritten. This allows | |
multiple calls to `namespace` to preserve existing namespaced properties. | |
If the first token in the namespace string is "YAHOO", that token is | |
discarded. This is legacy behavior for backwards compatibility with YUI 2. | |
Be careful with namespace tokens. Reserved words may work in some browsers | |
and not others. For instance, the following will fail in some browsers | |
because the supported version of JavaScript reserves the word "long": | |
Y.namespace('really.long.nested.namespace'); | |
Note: If you pass multiple arguments to create multiple namespaces, only the | |
last one created is returned from this function. | |
*@param namespace One or more namespaces to create. | |
*@returns Reference to the last namespace object created. | |
*/ | |
namespace(...args: String[]): Object; | |
/** | |
* Reports an error. | |
The reporting mechanism is controlled by the `throwFail` configuration | |
attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is | |
truthy, a JS exception is thrown. | |
If an `errorFn` is specified in the config it must return `true` to indicate | |
that the exception was handled and keep it from being thrown. | |
*@param msg Error message. | |
*@param e JavaScript error object or an error string. | |
*@param src Source of the error (such as the name of the module in | |
which the error occurred). | |
*/ | |
error(msg: String, e?: Error | String, src?: String): void; | |
/** | |
* Generates an id string that is unique among all YUI instances in this | |
execution context. | |
*@param pre Prefix. | |
*@returns Unique id. | |
*/ | |
guid(pre?: String): String; | |
/** | |
* Returns a unique id associated with the given object and (if *readOnly* is | |
falsy) stamps the object with that id so it can be identified in the future. | |
Stamping an object involves adding a `_yuid` property to it that contains | |
the object's id. One exception to this is that in Internet Explorer, DOM | |
nodes have a `uniqueID` property that contains a browser-generated unique | |
id, which will be used instead of a YUI-generated id when available. | |
*@param o Object to stamp. | |
*@param readOnly If truthy and the given object has not already | |
been stamped, the object will not be modified and `null` will be | |
returned. | |
*@returns Object's unique id, or `null` if *readOnly* was truthy and | |
the given object was not already stamped. | |
*/ | |
stamp(o: Object, readOnly: Boolean): String; | |
/** | |
* Destroys this YUI instance. | |
*/ | |
destroy(): void; | |
/** | |
* Safe `instanceof` wrapper that works around a memory leak in IE when the | |
object being tested is `window` or `document`. | |
Unless you are testing objects that may be `window` or `document`, you | |
should use the native `instanceof` operator instead of this method. | |
*@param o Object to check. | |
*@param type Class to check against. | |
*/ | |
instanceOf(o: Object, type: Object): void; | |
} | |
/** | |
* nested classes | |
*/ | |
interface YUI { | |
Promise: typeof YUI.Promise; | |
Subscriber: typeof YUI.Subscriber; | |
EventHandle: typeof YUI.EventHandle; | |
Node: typeof YUI.Node; | |
NodeList: typeof YUI.NodeList; | |
Widget: typeof YUI.Widget; | |
DiagramBuilder: typeof YUI.DiagramBuilder; | |
RadioCellEditor: typeof YUI.RadioCellEditor; | |
DataTable: typeof YUI.DataTable; | |
ModelList: typeof YUI.ModelList; | |
Model: typeof YUI.Model; | |
} | |
/***************************************************/ | |
/* YUI is a namespace...............YUI.Widget */ | |
/***************************************************/ | |
namespace YUI { | |
class Promise { | |
/** | |
* A promise represents a value that may not yet be available. Promises allow | |
you t | |
* @param fn A function where to insert the logic that resolves this | |
promise. Receives `resolve` and `reject` functions as parameters. | |
This function is called synchronously. | |
undefined | |
*/ | |
constructor(fn: Function); | |
/** | |
* Schedule execution of a callback to either or both of "fulfill" and | |
"reject" res | |
* @param callback function to execute if the promise | |
resolves successfully | |
* @param errback function to execute if the promise | |
resolves unsuccessfully | |
* @returns A promise wrapping the resolution of either "resolve" or | |
"reject" callback | |
*/ | |
then(callback: Function, errback: Function): Promise; | |
/** | |
* A shorthand for `promise.then(undefined, callback)`. | |
Returns a new promise and | |
* @param Function errback Callback to be called in case this promise is | |
rejected | |
* @returns A new promise modified by the behavior of the error | |
callback | |
*/ | |
catch(Function: any): Promise; | |
/** | |
* Returns the current status of the operation. Possible results are | |
"pending", "fu | |
* @returns | |
*/ | |
/** | |
* Checks if an object or value is a promise. This is cross-implementation | |
compatib | |
* @param obj The object to test | |
* @returns Whether the object is a promise or not | |
*/ | |
isPromise(obj: any): Boolean; | |
/** | |
* Ensures that a certain value is a promise. If it is not a promise, it wraps it | |
i | |
* @param Any object that may or may not be a promise | |
* @returns | |
*/ | |
resolve(Any: any): Promise; | |
/** | |
* A shorthand for creating a rejected promise. | |
* @param reason Reason for the rejection of this promise. Usually an Error | |
Object | |
* @returns A rejected promise | |
*/ | |
reject(reason: any): Promise; | |
/** | |
* Returns a promise that is resolved or rejected when all values are resolved or | |
a | |
* @param values An array of any kind of values, promises or not. If a value is not | |
* @returns [Promise] A promise for an array of all the fulfillment values | |
*/ | |
static all(values: any[]): Promise; | |
/** | |
* Returns a promise that is resolved or rejected when any of values is either | |
reso | |
* @param values An array of values or promises | |
* @returns | |
*/ | |
race(values: any[]): Promise; | |
} | |
/** | |
* Stores the subscriber information to be used when the event fires. | |
*/ | |
export class Subscriber { | |
/** | |
* Stores the subscriber information to be used when the event fires. | |
* @param fn The wrapped function to execute. | |
* @param context The value of the keyword 'this' in the listener. | |
* @param args 0..n additional arguments to supply the listener. | |
undefined | |
*/ | |
constructor(fn: Function, context: Object, ...args: any[]); | |
/** | |
* Executes the subscriber. | |
* @param args Arguments array for the subscriber. | |
* @param ce The custom event that sent the notification. | |
* @returns | |
*/ | |
notify(args: any[], ce: CustomEvent): void; | |
/** | |
* Returns true if the fn and obj match this objects properties. | |
Used by the unsubs | |
* @param fn the function to execute. | |
* @param context optional 'this' keyword for the listener. | |
* @returns true if the supplied arguments match this | |
subscriber's signature. | |
*/ | |
contains(fn: Function, context: Object): Boolean; | |
} | |
/** | |
* Return value from all subscribe operations | |
*/ | |
export class EventHandle { | |
/** | |
* Return value from all subscribe operations | |
* @param evt the custom event. | |
* @param sub the subscriber. | |
undefined | |
*/ | |
constructor(evt: CustomEvent, sub: Subscriber); | |
/** | |
* Detaches this subscriber | |
* @returns the number of detached listeners | |
*/ | |
/** | |
* Monitor the event state for the subscribed event. The first parameter | |
is what s | |
* @param what what to monitor ('attach', 'detach', 'publish'). | |
* @returns return value from the monitor event subscription. | |
*/ | |
monitor(what: String): EventHandle; | |
} | |
/** | |
* The Node class provides a wrapper for manipulating DOM Nodes. | |
Node properties can be accessed via th | |
*/ | |
export class Node { | |
/** | |
* The Node class provides a wrapper for manipulating DOM Nodes. | |
Node properties ca | |
* @param node the DOM node to be mapped to the Node instance. | |
undefined | |
*/ | |
constructor(node: HTMLElement); | |
/** | |
* Gets the current center position of the node in page coordinates. | |
* @returns The XY position of the node | |
*/ | |
/** | |
* Returns the combined size of the margin for the specified sides. | |
* @param sides Can be t, r, b, l or any combination of those to | |
represent the top, right, bottom, or left sides. | |
* @returns | |
*/ | |
getMargin(sides: String): Number; | |
/** | |
* Returns the combined width of the border for the specified sides. | |
* @param sides Can be t, r, b, l or any combination of those to | |
represent the top, right, bottom, or left sides. | |
* @returns | |
*/ | |
getPadding(sides: String): Number; | |
/** | |
* Sets the id of the Node instance if the object does not have one. The | |
generated | |
* @returns The current id of the node | |
*/ | |
/** | |
* Creates a hover interaction. | |
* @param overFn | |
* @param outFn | |
* @returns The current Node instance | |
*/ | |
hover(overFn: String, outFn: String): Node; | |
/** | |
* Gets or sets the HTML contents of the node. If the `value` is passed it's | |
set th | |
* @param value A string of html to set as the content of the node | |
instance. | |
* @returns | |
*/ | |
html(value: String): void; | |
/** | |
* Gets the outerHTML of a node, which islike innerHTML, except that it | |
actually co | |
* @returns The outerHTML of the given element. | |
*/ | |
/** | |
* Inserts a `newNode` after the node instance (i.e., as the next sibling). | |
If the | |
* @param newNode Node to insert. | |
* @returns | |
*/ | |
placeAfter(newNode: Node): void; | |
/** | |
* Inserts a `newNode` before the node instance (i.e., as the previous | |
sibling). If | |
* @param newNode Node to insert. | |
* @returns | |
*/ | |
placeBefore(newNode: Node): void; | |
/** | |
* Inserts the node instance to the begining of the `selector` node (i.e., | |
insert b | |
* @param selector A selector, element, HTML string, Node | |
* @returns | |
*/ | |
prependTo(selector: Node | String): void; | |
/** | |
* Adds one or more CSS classes to an element and remove the class(es) from | |
the sib | |
* @param cssClass | |
* @returns | |
*/ | |
radioClass(cssClass: String): void; | |
/** | |
* Generates an unique identifier and reset the id attribute of the node | |
instance u | |
* @param prefix Optional prefix for the guid. | |
* @returns | |
*/ | |
resetId(prefix?: String): void; | |
/** | |
* Selects a substring of text inside of the input element. | |
* @param start The index to start the selection range from | |
* @param end The index to end the selection range at | |
* @returns | |
*/ | |
selectText(start: Number, end: Number): void; | |
/** | |
* Enables text selection for this element (normalized across browsers). | |
* @param noRecurse | |
* @returns | |
*/ | |
selectable(noRecurse: any): void; | |
/** | |
* Stops the specified event(s) from bubbling and optionally prevents the | |
default a | |
* @param eventName An event or array of events to stop from | |
bubbling | |
* @param preventDefault (optional) true to prevent the default | |
action too | |
* @returns | |
*/ | |
swallowEvent(eventName: String | any[], preventDefault?: Boolean): void; | |
/** | |
* Gets or sets the combined text contents of the node instance, including | |
it's des | |
* @param text A string of text to set as the content of the node | |
instance. | |
* @returns | |
*/ | |
text(text: String): void; | |
/** | |
* Displays or hide the node instance. | |
NOTE: This method assume that your node wer | |
* @param on Whether to force the toggle. Optional. | |
* @param callback A function to run after the visibility change. | |
Optional. | |
* @returns | |
*/ | |
toggle(on: Boolean, callback: Function): void; | |
/** | |
* Disables text selection for this element (normalized across browsers). | |
* @param noRecurse | |
* @returns | |
*/ | |
unselectable(noRecurse: any): void; | |
/** | |
* Gets or sets the value attribute of the node instance. If the `value` is | |
passed | |
* @param value Value to be set. Optional. | |
* @returns | |
*/ | |
val(value: String): void; | |
/** | |
* Returns the width of the content, not including the padding, border or | |
margin. I | |
* @returns | |
*/ | |
/** | |
* Returns the height of the content, not including the padding, border or | |
margin. | |
* @returns | |
*/ | |
/** | |
* Returns the size of the box from inside of the border, which is the | |
`offsetWidth | |
* @returns | |
*/ | |
/** | |
* Returns the size of the box from inside of the border, which is offsetHeight | |
plu | |
* @returns | |
*/ | |
/** | |
* Returns the outer width of the box including the border, if true is passed as | |
th | |
* @returns | |
*/ | |
/** | |
* Returns the outer height of the box including the border, if true is passed | |
as t | |
* @returns | |
*/ | |
/** | |
* Determines whether the node has the given className. | |
* @param className the class name to search for | |
* @returns Whether or not the node has the specified class | |
*/ | |
hasClass(className: String): Boolean; | |
/** | |
* Adds a class name to the node. | |
* @param className the class name to add to the node's class attribute | |
* @returns | |
*/ | |
addClass(className: String): void; | |
/** | |
* Removes a class name from the node. | |
* @param className the class name to remove from the node's class attribute | |
* @returns | |
*/ | |
removeClass(className: String): void; | |
/** | |
* Replace a class with another class on the node. | |
If no oldClassName is present, t | |
* @param oldClassName the class name to be replaced | |
* @param newClassName the class name that will be replacing the old class name | |
* @returns | |
*/ | |
replaceClass(oldClassName: String, newClassName: String): void; | |
/** | |
* If the className exists on the node it is removed, if it doesn't exist it is add | |
* @param className the class name to be toggled | |
* @param force Option to force adding or removing the class. | |
* @returns | |
*/ | |
toggleClass(className: String, force: Boolean): void; | |
/** | |
* Retrieves the DOM node bound to a Node instance | |
* @param node The Node instance or an HTMLElement | |
* @returns The DOM node bound to the Node instance. If a DOM node is passed | |
as the node argument, it is simply returned. | |
*/ | |
getDOMNode(node: Node | HTMLElement): HTMLElement; | |
/** | |
* Checks Node return values and wraps DOM Nodes as Y.Node instances | |
and DOM Collec | |
* @param node The Node instance or an HTMLElement | |
* @returns Depends on what is returned from the DOM node. | |
*/ | |
scrubVal(node: HTMLElement | HTMLElement[] | Node): Node | NodeList | any; | |
/** | |
* Adds methods to the Y.Node prototype, routing through scrubVal. | |
* @param name The name of the method to add | |
* @param fn The function that becomes the method | |
* @param context An optional context to call the method with | |
(defaults to the Node instance) | |
* @returns Depends on what is returned from the DOM node. | |
*/ | |
addMethod(name: String, fn: Function, context?: Object): any; | |
/** | |
* Imports utility methods to be added as Y.Node methods. | |
* @param host The object that contains the method to import. | |
* @param name The name of the method to import | |
* @param altName An optional name to use in place of the host name | |
* @param context An optional context to call the method with | |
* @returns | |
*/ | |
importMethod(host: Object, name: String, altName?: String, context?: Object): void; | |
/** | |
* Returns a single Node instance bound to the node or the | |
first element matching t | |
* @param node a node or Selector | |
* @returns a Node instance or null if no match found. | |
*/ | |
one(node: String | HTMLElement): Node | any; | |
/** | |
* The default setter for DOM properties | |
Called with instance context (this === the | |
* @param name The attribute/property being set | |
* @param val The value to be set | |
* @returns The value | |
*/ | |
DEFAULT_SETTER(name: String, val: any): any; | |
/** | |
* The default getter for DOM properties | |
Called with instance context (this === the | |
* @param name The attribute/property to look up | |
* @returns The current value | |
*/ | |
DEFAULT_GETTER(name: String): any; | |
/** | |
* The method called when outputting Node instances as strings | |
* @returns A string representation of the Node instance | |
*/ | |
/** | |
* Returns an attribute value on the Node instance. | |
Unless pre-configured (via `Nod | |
* @param attr The attribute | |
* @returns The current value of the attribute | |
*/ | |
get(attr: String): any; | |
/** | |
* Sets an attribute on the Node instance. | |
Unless pre-configured (via Node.ATTRS), | |
* @param attr The attribute to be set. | |
* @param val The value to set the attribute to. | |
* @returns | |
*/ | |
set(attr: String, val: any): void; | |
/** | |
* Sets multiple attributes. | |
* @param attrMap an object of name/value pairs to set | |
* @returns | |
*/ | |
setAttrs(attrMap: Object): void; | |
/** | |
* Returns an object containing the values for the requested attributes. | |
* @param attrs an array of attributes to get values | |
* @returns An object with attribute name/value pairs. | |
*/ | |
getAttrs(attrs: _ARRAY_): Object; | |
/** | |
* Compares nodes to determine if they match. | |
Node instances can be compared to eac | |
* @param refNode The reference node to compare to the node. | |
* @returns True if the nodes match, false if they do not. | |
*/ | |
compareTo(refNode: HTMLElement | Node): Boolean; | |
/** | |
* Determines whether the node is appended to the document. | |
* @param doc optional An optional document to check against. | |
Defaults to current document. | |
* @returns Whether or not this node is appended to the document. | |
*/ | |
inDoc(doc: Node | HTMLElement): Boolean; | |
/** | |
* Returns the nearest ancestor that passes the test applied by supplied boolean me | |
* @param fn A selector string or boolean method for testing elements. | |
If a function is used, it receives the current node being tested as the only argument. | |
If fn is not passed as an argument, the parent node will be returned. | |
* @param testSelf optional Whether or not to include the element in the scan | |
* @param stopFn optional A selector string or boolean | |
method to indicate when the search should stop. The search bails when the function | |
returns true or the selector matches. | |
If a function is used, it receives the current node being tested as the only argument. | |
* @returns The matching Node instance or null if not found | |
*/ | |
ancestor(fn: String | Function, testSelf: Boolean, stopFn: String | Function): Node; | |
/** | |
* Returns the ancestors that pass the test applied by supplied boolean method. | |
* @param fn A selector string or boolean method for testing elements. | |
* @param testSelf optional Whether or not to include the element in the scan | |
If a function is used, it receives the current node being tested as the only argument. | |
* @returns A NodeList instance containing the matching elements | |
*/ | |
ancestors(fn: String | Function, testSelf: Boolean): NodeList; | |
/** | |
* Returns the previous matching sibling. | |
Returns the nearest element node sibling | |
* @param fn A selector or boolean method for testing elements. | |
If a function is used, it receives the current node being tested as the only argument. | |
* @param all Whether text nodes as well as element nodes should be returned, or | |
just element nodes will be returned(default) | |
* @returns Node instance or null if not found | |
*/ | |
previous(fn: String | Function, all: Boolean): Node; | |
/** | |
* Returns the next matching sibling. | |
Returns the nearest element node sibling if n | |
* @param fn A selector or boolean method for testing elements. | |
If a function is used, it receives the current node being tested as the only argument. | |
* @param all Whether text nodes as well as element nodes should be returned, or | |
just element nodes will be returned(default) | |
* @returns Node instance or null if not found | |
*/ | |
next(fn: String | Function, all: Boolean): Node; | |
/** | |
* Returns all matching siblings. | |
Returns all siblings if no method provided. | |
* @param fn A selector or boolean method for testing elements. | |
If a function is used, it receives the current node being tested as the only argument. | |
* @returns NodeList instance bound to found siblings | |
*/ | |
siblings(fn: String | Function): NodeList; | |
/** | |
* Retrieves a single Node instance, the first element matching the given | |
CSS selec | |
* @param selector The CSS selector to test against. | |
* @returns A Node instance for the matching HTMLElement or null | |
if no match found. | |
*/ | |
one(selector: String): Node | any; | |
/** | |
* Retrieves a NodeList based on the given CSS selector. | |
* @param selector The CSS selector to test against. | |
* @returns A NodeList instance for the matching HTMLCollection/Array. | |
*/ | |
all(selector: String): NodeList; | |
/** | |
* Test if the supplied node matches the supplied selector. | |
* @param selector The CSS selector to test against. | |
* @returns Whether or not the node matches the selector. | |
*/ | |
test(selector: String): Boolean; | |
/** | |
* Removes the node from its parent. | |
Shortcut for myNode.get('parentNode').removeCh | |
* @param destroy whether or not to call destroy() on the node | |
after removal. | |
* @returns | |
*/ | |
remove(destroy: Boolean): void; | |
/** | |
* Replace the node with the other node. This is a DOM update only | |
and does not cha | |
* @param newNode Node to be inserted | |
* @returns | |
*/ | |
replace(newNode: Node | HTMLElement): void; | |
/** | |
* | |
* @param node Node to be inserted | |
* @param refNode Node to be replaced | |
* @returns The replaced node | |
*/ | |
replaceChild(node: String | HTMLElement | Node, refNode: HTMLElement | Node): Node; | |
/** | |
* Nulls internal node references, removes any plugins and event listeners. | |
Note th | |
* @param recursivePurge (optional) Whether or not to remove listeners from the | |
node's subtree (default is false) | |
* @returns | |
*/ | |
destroy(recursivePurge?: Boolean): void; | |
/** | |
* Invokes a method on the Node instance | |
* @param method The name of the method to invoke | |
* @param args* Arguments to invoke the method with. | |
* @returns Whatever the underly method returns. | |
DOM Nodes and Collections return values | |
are converted to Node/NodeList instances. | |
*/ | |
invoke(method: String, args: any): any; | |
/** | |
* Swap DOM locations with the given node. | |
This does not change which DOM node each | |
* @param otherNode The node to swap with | |
* @returns | |
*/ | |
swap(otherNode: Node): void; | |
/** | |
* Removes and destroys all of the nodes within the node. | |
* @returns | |
*/ | |
/** | |
* Returns the DOM node bound to the Node instance | |
* @returns | |
*/ | |
/** | |
* Returns a new dom node using the provided markup string. | |
* @param html The markup used to create the element. | |
Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> | |
to escape html content. | |
* @param doc An optional document context | |
* @returns A Node instance bound to a DOM node or fragment | |
*/ | |
create(html: String, doc?: HTMLDocument): Node; | |
/** | |
* Creates a new Node using the provided markup string. | |
* @param html The markup used to create the element. | |
Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> | |
to escape html content. | |
* @param doc An optional document context | |
* @returns A Node instance bound to a DOM node or fragment | |
*/ | |
create(html: String, doc?: HTMLDocument): Node; | |
/** | |
* Inserts the content before the reference node. | |
* @param content The content to insert. | |
Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> | |
to escape html content. | |
* @param where The position to insert at. | |
Possible "where" arguments | |
<dl> | |
<dt>Y.Node</dt> | |
<dd>The Node to insert before</dd> | |
<dt>HTMLElement</dt> | |
<dd>The element to insert before</dd> | |
<dt>Int</dt> | |
<dd>The index of the child element to insert before</dd> | |
<dt>"replace"</dt> | |
<dd>Replaces the existing HTML</dd> | |
<dt>"before"</dt> | |
<dd>Inserts before the existing HTML</dd> | |
<dt>"before"</dt> | |
<dd>Inserts content before the node</dd> | |
<dt>"after"</dt> | |
<dd>Inserts content after the node</dd> | |
</dl> | |
* @returns | |
*/ | |
insert(content: String | Node | HTMLElement | NodeList | HTMLCollection, where: number | Node | HTMLElement | String): void; | |
/** | |
* Inserts the content as the firstChild of the node. | |
* @param content The content to insert. | |
Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> | |
to escape html content. | |
* @returns | |
*/ | |
prepend(content: String | Node | HTMLElement): void; | |
/** | |
* Inserts the content as the lastChild of the node. | |
* @param content The content to insert. | |
Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> | |
to escape html content. | |
* @returns | |
*/ | |
append(content: String | Node | HTMLElement): void; | |
/** | |
* | |
* @param node Node to be appended. | |
Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> | |
to escape html content. | |
* @returns The appended node | |
*/ | |
appendChild(node: String | HTMLElement | Node): Node; | |
/** | |
* | |
* @param newNode Node to be appended | |
* @param refNode Node to be inserted before. | |
Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> | |
to escape html content. | |
* @returns The inserted node | |
*/ | |
insertBefore(newNode: String | HTMLElement | Node, refNode: HTMLElement | Node): Node; | |
/** | |
* Appends the node to the given node. | |
* @param node The node to append to. | |
If `node` is a string it will be considered as a css selector and only the first matching node will be used. | |
* @returns | |
*/ | |
appendTo(node: Node | HTMLElement | String): void; | |
/** | |
* Replaces the node's current html content with the content provided. | |
Note that th | |
* @param content The content to insert | |
* @returns | |
*/ | |
setHTML(content: String | Node | HTMLElement | NodeList | HTMLCollection): void; | |
/** | |
* Returns the node's current html content (e.g. innerHTML) | |
* @returns The html content | |
*/ | |
/** | |
* Retrieves arbitrary data stored on a Node instance. | |
If no data is associated wit | |
* @param name Optional name of the data field to retrieve. | |
If no name is given, all data is returned. | |
* @returns Whatever is stored at the given field, | |
or an object hash of all fields. | |
*/ | |
getData(name?: String): any | Object; | |
/** | |
* Stores arbitrary data on a Node instance. | |
This is not stored with the DOM node. | |
* @param name The name of the field to set. If no val | |
is given, name is treated as the data and overrides any existing data. | |
* @param val The value to be assigned to the field. | |
* @returns | |
*/ | |
setData(name: String, val: any): void; | |
/** | |
* Clears internally stored data. | |
* @param name The name of the field to clear. If no name | |
is given, all data is cleared. | |
* @returns | |
*/ | |
clearData(name: String): void; | |
/** | |
* <p>Sets up a delegation listener for an event occurring inside the Node. | |
The del | |
* @param type the event type to delegate | |
* @param fn the callback function to execute. This function | |
will be provided the event object for the delegated event. | |
* @param spec a selector that must match the target of the | |
event or a function to test target and its parents for a match | |
* @param context optional argument that specifies what 'this' refers to. | |
* @param args 0..n additional arguments to pass on to the callback function. | |
These arguments will be added after the event object. | |
* @returns the detach handle | |
*/ | |
delegate(type: String, fn: Function, spec: String | Function, context: Object, args: any): EventHandle; | |
/** | |
* Simulates an event on the node. | |
* @param type The type of event (i.e., "click"). | |
* @param options (Optional) Extra options to copy onto the event object. | |
* @returns | |
*/ | |
simulate(type: String, options: Object): void; | |
/** | |
* Simulates the higher user level gesture of the given name on this node. | |
This met | |
* @param name The name of the supported gesture to simulate. The | |
supported gesture name is one of "tap", "doubletap", "press", "move", | |
"flick", "pinch" and "rotate". | |
* @param options Extra options used to define the gesture behavior: | |
Valid options properties for the `tap` gesture: | |
* @param cb The callback to execute when the asynchronouse gesture | |
simulation is completed. | |
* @returns | |
*/ | |
simulateGesture(name: String, options: Object, cb: Function): void; | |
/** | |
* Removes event listeners from the node and (optionally) its subtree | |
* @param recurse (optional) Whether or not to remove listeners from the | |
node's subtree | |
* @param type (optional) Only remove listeners of the specified type | |
* @returns | |
*/ | |
purge(recurse?: Boolean, type?: String): void; | |
/** | |
* Subscribe a callback function to execute in response to a DOM event or custom | |
ev | |
* @param type The name of the event | |
* @param fn The callback to execute in response to the event | |
* @param context Override `this` object in callback | |
* @param arg* 0..n additional arguments to supply to the subscriber | |
* @returns A subscription handle capable of detaching that | |
subscription | |
*/ | |
on(type: String, fn: Function, context?: Object, ...args: any[]): EventHandle; | |
/** | |
* Passes through to DOM method. | |
* @param node Node to be removed | |
* @returns The removed node | |
*/ | |
removeChild(node: HTMLElement | Node): Node; | |
/** | |
* Passes through to DOM method. | |
* @returns Whether or not the node has any childNodes | |
*/ | |
/** | |
* Passes through to DOM method. | |
* @param deep Whether or not to perform a deep clone, which includes | |
subtree and attributes | |
* @returns The clone | |
*/ | |
cloneNode(deep: Boolean): Node; | |
/** | |
* Passes through to DOM method. | |
* @param attribute The attribute to test for | |
* @returns Whether or not the attribute is present | |
*/ | |
hasAttribute(attribute: String): Boolean; | |
/** | |
* Passes through to DOM method. | |
* @returns | |
*/ | |
/** | |
* Passes through to DOM method. | |
* @param tagName The tagName to collect | |
* @returns A NodeList representing the HTMLCollection | |
*/ | |
getElementsByTagName(tagName: String): NodeList; | |
/** | |
* Passes through to DOM method. | |
* @returns | |
*/ | |
/** | |
* Passes through to DOM method. | |
* @returns | |
*/ | |
/** | |
* Passes through to DOM method. | |
Only valid on FORM elements | |
* @returns | |
*/ | |
/** | |
* Passes through to DOM method. | |
Only valid on FORM elements | |
* @returns | |
*/ | |
/** | |
* Passes through to DOM method. | |
* @returns | |
*/ | |
/** | |
* Passes through to DOM method. | |
Only valid on TABLE elements | |
* @returns | |
*/ | |
/** | |
* Passes through to DOM method. | |
* @param attribute The attribute to be removed | |
* @returns | |
*/ | |
removeAttribute(attribute: String): void; | |
/** | |
* Determines whether the node is an ancestor of another HTML element in the DOM hi | |
* @param needle The possible node or descendent | |
* @returns Whether or not this node is the needle its ancestor | |
*/ | |
contains(needle: Node | HTMLElement): Boolean; | |
/** | |
* Allows setting attributes on DOM nodes, normalizing in some cases. | |
This passes t | |
* @param name The attribute name | |
* @param value The value to set | |
* @returns | |
*/ | |
setAttribute(name: String, value: String): void; | |
/** | |
* Allows getting attributes on DOM nodes, normalizing in some cases. | |
This passes t | |
* @param name The attribute name | |
* @returns The attribute value | |
*/ | |
getAttribute(name: String): String; | |
/** | |
* Wraps the given HTML around the node. | |
* @param html The markup to wrap around the node. | |
* @returns | |
*/ | |
wrap(html: String): void; | |
/** | |
* Removes the node's parent node. | |
* @returns | |
*/ | |
/** | |
* Applies a unique ID to the node if none exists | |
* @returns The existing or generated ID | |
*/ | |
/** | |
* Loads content from the given url and replaces the Node's | |
existing content with t | |
* @param url The URL to load via XMLHttpRequest. | |
* @param selector An optional selector representing a subset of an HTML document to load. | |
* @param callback An optional function to run after the content has been loaded. | |
* @returns | |
*/ | |
load(url: String, selector?: String, callback?: Function): void; | |
/** | |
* Registers plugins to be instantiated at the class level (plugins | |
which should be | |
* @param plugin Either the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined) | |
* @param config (Optional) If plugin is the plugin class, the configuration for the plugin | |
* @returns | |
*/ | |
plug(plugin: Function | _ARRAY_, config: Object): void; | |
/** | |
* Unregisters any class level plugins which have been registered by the Node | |
* @param plugin The plugin class, or an array of plugin classes | |
* @returns | |
*/ | |
unplug(plugin: Function | _ARRAY_): void; | |
/** | |
* Compares the intersection of the node with another node or region | |
* @param node2 The node or region to compare with. | |
* @param altRegion An alternate region to use (rather than this node's). | |
* @returns An object representing the intersection of the regions. | |
*/ | |
intersect(node2: Node | Object, altRegion: Object): Object; | |
/** | |
* Determines whether or not the node is within the given region. | |
* @param node2 The node or region to compare with. | |
* @param all Whether or not all of the node must be in the region. | |
* @param altRegion An alternate region to use (rather than this node's). | |
* @returns True if in region, false if not. | |
*/ | |
inRegion(node2: Node | Object, all: Boolean, altRegion: Object): Boolean; | |
/** | |
* Gets the current position of the node in page coordinates. | |
* @returns The XY position of the node | |
*/ | |
/** | |
* Set the position of the node in page coordinates, regardless of how the node is | |
* @param xy Contains X & Y values for new position (coordinates are page-based) | |
* @returns | |
*/ | |
setXY(xy: _ARRAY_): void; | |
/** | |
* Gets the current position of the node in page coordinates. | |
* @returns The X position of the node | |
*/ | |
/** | |
* Set the position of the node in page coordinates, regardless of how the node is | |
* @param x X value for new position (coordinates are page-based) | |
* @returns | |
*/ | |
setX(x: Number): void; | |
/** | |
* Gets the current position of the node in page coordinates. | |
* @returns The Y position of the node | |
*/ | |
/** | |
* Set the position of the node in page coordinates, regardless of how the node is | |
* @param y Y value for new position (coordinates are page-based) | |
* @returns | |
*/ | |
setY(y: Number): void; | |
/** | |
* Swaps the XY position of this node with another node. | |
* @param otherNode The node to swap with. | |
* @returns | |
*/ | |
swapXY(otherNode: Node | HTMLElement): void; | |
/** | |
* Sets a style property of the node. | |
Use camelCase (e.g. 'backgroundColor') for mu | |
* @param attr The style attribute to set. | |
* @param val The value. | |
* @returns | |
*/ | |
setStyle(attr: String, val: String | Number): void; | |
/** | |
* Sets multiple style properties on the node. | |
Use camelCase (e.g. 'backgroundColor | |
* @param hash An object literal of property:value pairs. | |
* @returns | |
*/ | |
setStyles(hash: Object): void; | |
/** | |
* Returns the style's current value. | |
Use camelCase (e.g. 'backgroundColor') for mu | |
* @param attr The style attribute to retrieve. | |
* @returns The current value of the style property for the element. | |
*/ | |
getStyle(attr: String): String; | |
/** | |
* Returns the computed value for the given style property. | |
Use camelCase (e.g. 'ba | |
* @param attr The style attribute to retrieve. | |
* @returns The computed value of the style property for the element. | |
*/ | |
getComputedStyle(attr: String): String; | |
/** | |
* Makes the node visible. | |
If the "transition" module is loaded, show optionally | |
an | |
* @param name A named Transition effect to use as the show effect. | |
* @param config Options to use with the transition. | |
* @param callback An optional function to run after the transition completes. | |
* @returns | |
*/ | |
show(name: String, config: Object, callback?: Function): void; | |
/** | |
* Displays or hides the node. | |
If the "transition" module is loaded, toggleView opt | |
* @param on An optional boolean value to force the node to be shown or hidden | |
* @param callback An optional function to run after the transition completes. | |
* @returns | |
*/ | |
toggleView(on?: Boolean, callback?: Function): void; | |
/** | |
* Hides the node. | |
If the "transition" module is loaded, hide optionally | |
animates t | |
* @param name A named Transition effect to use as the show effect. | |
* @param config Options to use with the transition. | |
* @param callback An optional function to run after the transition completes. | |
* @returns | |
*/ | |
hide(name: String, config: Object, callback?: Function): void; | |
/** | |
* Animate one or more css properties to a given value. Requires the "transition" m | |
* @param config An object containing one or more style properties, a duration and an easing. | |
* @param callback A function to run after the transition has completed. | |
* @returns | |
*/ | |
transition(config: Object, callback: Function): void; | |
} | |
/** | |
* The NodeList class provides a wrapper for manipulating DOM NodeLists. | |
NodeList properties can be acc | |
*/ | |
export class NodeList { | |
/** | |
* The NodeList class provides a wrapper for manipulating DOM NodeLists. | |
NodeList p | |
* @param nodes A selector, DOM element, Node, list of DOM elements, or list of Nodes with which to populate this NodeList. | |
undefined | |
*/ | |
constructor(nodes: String | Element | Node | any[]); | |
/** | |
* Allows setting attributes on DOM nodes, normalizing in some cases. | |
This passes t | |
* @param name The attribute name | |
* @param value The value to set | |
* @returns | |
*/ | |
setAttribute(name: String, value: String): void; | |
/** | |
* Allows getting attributes on DOM nodes, normalizing in some cases. | |
This passes t | |
* @param name The attribute name | |
* @returns The attribute value | |
*/ | |
getAttribute(name: String): String; | |
/** | |
* Determines whether each node has the given className. | |
* @param className the class name to search for | |
* @returns An array of booleans for each node bound to the NodeList. | |
*/ | |
hasClass(className: String): _ARRAY_; | |
/** | |
* Adds a class name to each node. | |
* @param className the class name to add to each node's class attribute | |
* @returns | |
*/ | |
addClass(className: String): void; | |
/** | |
* Removes a class name from each node. | |
* @param className the class name to remove from each node's class attribute | |
* @returns | |
*/ | |
removeClass(className: String): void; | |
/** | |
* Replace a class with another class for each node. | |
If no oldClassName is present, | |
* @param oldClassName the class name to be replaced | |
* @param newClassName the class name that will be replacing the old class name | |
* @returns | |
*/ | |
replaceClass(oldClassName: String, newClassName: String): void; | |
/** | |
* For each node, if the className exists on the node it is removed, if it doesn't | |
* @param className the class name to be toggled | |
* @returns | |
*/ | |
toggleClass(className: String): void; | |
/** | |
* Called on each Node instance | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance | |
Note that this passes to innerHTML and is not escap | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance | |
* @returns | |
*/ | |
/** | |
* Retrieves arbitrary data stored on each Node instance | |
bound to the NodeList. | |
* @param name Optional name of the data field to retrieve. | |
If no name is given, all data is returned. | |
* @returns An array containing all of the data for each Node instance. | |
or an object hash of all fields. | |
*/ | |
getData(name?: String): _ARRAY_; | |
/** | |
* Stores arbitrary data on each Node instance bound to the | |
NodeList. This is not | |
* @param name The name of the field to set. If no name | |
is given, name is treated as the data and overrides any existing data. | |
* @param val The value to be assigned to the field. | |
* @returns | |
*/ | |
setData(name: String, val: any): void; | |
/** | |
* Clears data on all Node instances bound to the NodeList. | |
* @param name The name of the field to clear. If no name | |
is given, all data is cleared. | |
* @returns | |
*/ | |
clearData(name: String): void; | |
/** | |
* Subscribe a callback function for each `Node` in the collection to execute | |
in re | |
* @param type The name of the event | |
* @param fn The callback to execute in response to the event | |
* @param context Override `this` object in callback | |
* @param arg* 0..n additional arguments to supply to the subscriber | |
* @returns A subscription handle capable of detaching that | |
subscription | |
*/ | |
on(type: String, fn: Function, context: Object, arg: any): EventHandle; | |
/** | |
* Applies an one-time event listener to each Node bound to the NodeList. | |
* @param type The event being listened for | |
* @param fn The handler to call when the event fires | |
* @param context The context to call the handler with. | |
Default is the NodeList instance. | |
* @returns A subscription handle capable of detaching that | |
subscription | |
*/ | |
once(type: String, fn: Function, context: Object): EventHandle; | |
/** | |
* Applies an event listener to each Node bound to the NodeList. | |
The handler is cal | |
* @param type The event being listened for | |
* @param fn The handler to call when the event fires | |
* @param context The context to call the handler with. | |
Default is the NodeList instance. | |
* @returns A subscription handle capable of detaching that | |
subscription | |
*/ | |
after(type: String, fn: Function, context: Object): EventHandle; | |
/** | |
* Applies an one-time event listener to each Node bound to the NodeList | |
that will | |
* @param type The event being listened for | |
* @param fn The handler to call when the event fires | |
* @param context The context to call the handler with. | |
Default is the NodeList instance. | |
* @returns A subscription handle capable of detaching that | |
subscription | |
*/ | |
onceAfter(type: String, fn: Function, context: Object): EventHandle; | |
/** | |
* Called on each Node instance | |
* @returns | |
*/ | |
/** | |
* | |
* @returns | |
*/ | |
/** | |
* Allows getting attributes on DOM nodes, normalizing in some cases. | |
This passes t | |
* @param name The attribute name | |
* @returns The attribute value | |
*/ | |
getAttribute(name: String): String; | |
/** | |
* Allows setting attributes on DOM nodes, normalizing in some cases. | |
This passes t | |
* @param name The attribute name | |
* @param value The value to set | |
* @returns | |
*/ | |
setAttribute(name: String, value: String): void; | |
/** | |
* Allows for removing attributes on DOM nodes. | |
This passes through to the DOM node | |
* @param name The attribute to remove | |
* @returns | |
*/ | |
removeAttribute(name: String): void; | |
/** | |
* Removes the parent node from node in the list. | |
* @returns | |
*/ | |
/** | |
* Wraps the given HTML around each node. | |
* @param html The markup to wrap around the node. | |
* @returns | |
*/ | |
wrap(html: String): void; | |
/** | |
* Applies a unique ID to each node if none exists | |
* @returns The existing or generated ID | |
*/ | |
/** | |
* Adds a plugin to each node in the NodeList. | |
This will instantiate the plugin and | |
* @param P Accepts the plugin class, or an | |
object with a "fn" property specifying the plugin class and | |
a "cfg" property specifying the configuration for the Plugin. | |
<p> | |
Additionally an Array can also be passed in, with the above function or | |
object values, allowing the user to add multiple plugins in a single call. | |
</p> | |
* @param config (Optional) If the first argument is the plugin class, the second argument | |
can be the configuration for the plugin. | |
* @returns | |
*/ | |
plug(P: Function | Object | _ARRAY_, config: any): void; | |
/** | |
* Removes a plugin from all nodes in the NodeList. This will destroy the | |
plugin in | |
* @param plugin The namespace of the plugin, or the plugin class with the static NS namespace property defined. If not provided, | |
all registered plugins are unplugged. | |
* @returns | |
*/ | |
unplug(plugin: String | Function): void; | |
/** | |
* Returns an array of values for each node. | |
Use camelCase (e.g. 'backgroundColor') | |
* @param attr The style attribute to retrieve. | |
* @returns The current values of the style property for the element. | |
*/ | |
getStyle(attr: String): _ARRAY_; | |
/** | |
* Returns an array of the computed value for each node. | |
Use camelCase (e.g. 'backg | |
* @param attr The style attribute to retrieve. | |
* @returns The computed values for each node. | |
*/ | |
getComputedStyle(attr: String): _ARRAY_; | |
/** | |
* Sets a style property on each node. | |
Use camelCase (e.g. 'backgroundColor') for m | |
* @param attr The style attribute to set. | |
* @param val The value. | |
* @returns | |
*/ | |
setStyle(attr: String, val: String | Number): void; | |
/** | |
* Sets multiple style properties on each node. | |
Use camelCase (e.g. 'backgroundColo | |
* @param hash An object literal of property:value pairs. | |
* @returns | |
*/ | |
setStyles(hash: Object): void; | |
/** | |
* Makes each node visible. | |
If the "transition" module is loaded, show optionally | |
a | |
* @param name A named Transition effect to use as the show effect. | |
* @param config Options to use with the transition. | |
* @param callback An optional function to run after the transition completes. | |
* @returns | |
*/ | |
show(name: String, config: Object, callback?: Function): void; | |
/** | |
* Hides each node. | |
If the "transition" module is loaded, hide optionally | |
animates | |
* @param name A named Transition effect to use as the show effect. | |
* @param config Options to use with the transition. | |
* @param callback An optional function to run after the transition completes. | |
* @returns | |
*/ | |
hide(name: String, config: Object, callback?: Function): void; | |
/** | |
* Displays or hides each node. | |
If the "transition" module is loaded, toggleView op | |
* @param on An optional boolean value to force the nodes to be shown or hidden | |
* @param callback An optional function to run after the transition completes. | |
* @returns | |
*/ | |
toggleView(on?: Boolean, callback?: Function): void; | |
/** | |
* | |
* @param valueN Arrays/NodeLists and/or values to | |
concatenate to the resulting NodeList | |
* @returns A new NodeList comprised of this NodeList joined with the input. | |
*/ | |
concat(valueN: NodeList | _ARRAY_): NodeList; | |
/** | |
* | |
* @returns The last item in the NodeList, or null if the list is empty. | |
*/ | |
/** | |
* | |
* @param nodes One or more nodes to add to the end of the NodeList. | |
* @returns | |
*/ | |
push(nodes: Node | HTMLElement): void; | |
/** | |
* | |
* @returns The first item in the NodeList, or null if the NodeList is empty. | |
*/ | |
/** | |
* | |
* @param begin Zero-based index at which to begin extraction. | |
As a negative index, start indicates an offset from the end of the sequence. slice(-2) extracts the second-to-last element and the last element in the sequence. | |
* @param end Zero-based index at which to end extraction. slice extracts up to but not including end. | |
slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). | |
As a negative index, end indicates an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. | |
If end is omitted, slice extracts to the end of the sequence. | |
* @returns A new NodeList comprised of this NodeList joined with the input. | |
*/ | |
slice(begin: Number, end: Number): NodeList; | |
/** | |
* | |
* @param index Index at which to start changing the array. If negative, will begin that many elements from the end. | |
* @param howMany An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. In this case, you should specify at least one new element. If no howMany parameter is specified (second syntax above, which is a SpiderMonkey extension), all elements after index are removed. | |
{Node | HTMLElement| element1, ..., elementN | |
The elements to add to the array. If you don't specify any elements, splice simply removes elements from the array. | |
* @returns The element(s) removed. | |
*/ | |
splice(index: Number, howMany: Number): NodeList; | |
/** | |
* | |
* @param nodes One or more nodes to add to the NodeList. | |
* @returns | |
*/ | |
unshift(nodes: Node | HTMLElement): void; | |
/** | |
* Retrieves the DOM nodes bound to a NodeList instance | |
* @param nodelist The NodeList instance | |
* @returns The array of DOM nodes bound to the NodeList | |
*/ | |
getDOMNodes(nodelist: NodeList): _ARRAY_; | |
/** | |
* Import the named method, or methods from the host onto NodeList. | |
* @param host The object containing the methods to copy. Typically a prototype. | |
* @param name The name, or an Array of names of the methods to import onto NodeList. | |
* @param altName An alternative name to use for the method added to NodeList, which may differ from the name | |
of the original host object. Has no effect if <em>name</em> is an array of method names. | |
* @returns | |
*/ | |
importMethod(host: Object, name: String | String[], altName: String): void; | |
/** | |
* Retrieves the Node instance at the given index. | |
* @param index The index of the target Node. | |
* @returns The Node instance at the given index. | |
*/ | |
item(index: Number): Node; | |
/** | |
* Applies the given function to each Node in the NodeList. | |
* @param fn The function to apply. It receives 3 arguments: | |
the current node instance, the node's index, and the NodeList instance | |
* @param context optional An optional context to apply the function with | |
Default context is the current Node instance | |
* @returns | |
*/ | |
each(fn: Function, context: Object): void; | |
/** | |
* Executes the function once for each node until a true value is returned. | |
* @param fn The function to apply. It receives 3 arguments: | |
the current node instance, the node's index, and the NodeList instance | |
* @param context optional An optional context to execute the function from. | |
Default context is the current Node instance | |
* @returns Whether or not the function returned true for any node. | |
*/ | |
some(fn: Function, context: Object): Boolean; | |
/** | |
* Creates a documenFragment from the nodes bound to the NodeList instance | |
* @returns a Node instance bound to the documentFragment | |
*/ | |
/** | |
* Returns the index of the node in the NodeList instance | |
or -1 if the node isn't f | |
* @param node the node to search for | |
* @returns the index of the node value or -1 if not found | |
*/ | |
indexOf(node: Node | HTMLElement): Number; | |
/** | |
* Filters the NodeList instance down to only nodes matching the given selector. | |
* @param selector The selector to filter against | |
* @returns NodeList containing the updated collection | |
*/ | |
filter(selector: String): NodeList; | |
/** | |
* Creates a new NodeList containing all nodes at every n indices, where | |
remainder | |
* @param n The offset to use (return every nth node) | |
* @param r An optional remainder to use with the modulus operation (defaults to zero) | |
* @returns NodeList containing the updated collection | |
*/ | |
modulus(n: Number, r?: Number): NodeList; | |
/** | |
* Creates a new NodeList containing all nodes at odd indices | |
(zero-based index). | |
* @returns NodeList containing the updated collection | |
*/ | |
/** | |
* Creates a new NodeList containing all nodes at even indices | |
(zero-based index), | |
* @returns NodeList containing the updated collection | |
*/ | |
/** | |
* Reruns the initial query, when created using a selector query | |
* @returns | |
*/ | |
/** | |
* Returns the current number of items in the NodeList. | |
* @returns The number of items in the NodeList. | |
*/ | |
/** | |
* Determines if the instance is bound to any nodes | |
* @returns Whether or not the NodeList is bound to any nodes | |
*/ | |
/** | |
* Returns the DOM node bound to the Node instance | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance. Nulls internal node references, | |
removes any plugin | |
* @param recursivePurge (optional) Whether or not to | |
remove listeners from the node's subtree (default is false) | |
* @returns | |
*/ | |
destroy(recursivePurge?: Boolean): void; | |
/** | |
* Called on each Node instance. Removes and destroys all of the nodes | |
within the n | |
* @returns | |
*/ | |
/** | |
* Called on each Node instance. Removes the node from its parent. | |
Shortcut for myN | |
* @param destroy whether or not to call destroy() on the node | |
after removal. | |
* @returns | |
*/ | |
remove(destroy: Boolean): void; | |
/** | |
* Called on each Node instance. Sets an attribute on the Node instance. | |
Unless pre | |
* @param attr The attribute to be set. | |
* @param val The value to set the attribute to. | |
* @returns | |
*/ | |
set(attr: String, val: any): void; | |
/** | |
* | |
* @returns | |
*/ | |
/** | |
* Animate one or more css properties to a given value. Requires the "transition" m | |
* @param config An object containing one or more style properties, a duration and an easing. | |
* @param callback A function to run after the transition has completed. The callback fires | |
once per item in the NodeList. | |
* @param callbackOnce If true, the callback will be called only after the | |
last transition has completed | |
* @returns | |
*/ | |
transition(config: Object, callback: Function, callbackOnce: Boolean): void; | |
} | |
class Widget { | |
constructor(options: any); | |
render(id?: string | Node): void; | |
} | |
class DiagramBuilder extends Widget { | |
connectAll: any; | |
} | |
class RadioCellEditor extends Widget { | |
constructor(options: { | |
editable?: boolean; | |
options: { | |
[s: string]: string; | |
} | |
}); | |
} | |
/** | |
* <p> | |
A base class which objects requiring attributes and custom event support can | |
extend. Base also h | |
*/ | |
export class Base { | |
/** | |
* <p> | |
A base class which objects requiring attributes and custom event support can | |
* @param config Object with configuration property name/value pairs. The object can be | |
used to provide default values for the objects published attributes. | |
<p> | |
The config object can also contain the following non-attribute properties, providing a convenient | |
way to configure events listeners and plugins for the instance, as part of the constructor call: | |
</p> | |
<dl> | |
<dt>on</dt> | |
<dd>An event name to listener function map, to register event listeners for the "on" moment of the event. | |
A constructor convenience property for the <a href="Base.html#method_on">on</a> method.</dd> | |
<dt>after</dt> | |
<dd>An event name to listener function map, to register event listeners for the "after" moment of the event. | |
A constructor convenience property for the <a href="Base.html#method_after">after</a> method.</dd> | |
<dt>bubbleTargets</dt> | |
<dd>An object, or array of objects, to register as bubble targets for bubbled events fired by this instance. | |
A constructor convenience property for the <a href="EventTarget.html#method_addTarget">addTarget</a> method.</dd> | |
<dt>plugins</dt> | |
<dd>A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details). | |
A constructor convenience property for the <a href="Plugin.Host.html#method_plug">plug</a> method.</dd> | |
</dl> | |
undefined | |
*/ | |
constructor(config: Object); | |
/** | |
* Provides a way to safely modify a `Y.Base` subclass' static `ATTRS` after | |
the cl | |
* @param ctor The constructor function whose `ATTRS` should be | |
modified. If a `ctor` function is not specified, then `this` is assumed | |
to be the constructor which hosts the `ATTRS`. | |
* @param configs The collection of `ATTRS` configs to mix with the | |
existing attribute configurations. | |
* @returns | |
*/ | |
modifyAttrs(ctor: Function, configs: Object): void; | |
/** | |
* <p> | |
Builds a custom constructor function (class) from the | |
main function, and arr | |
* @param name The name of the new class. Used to define the NAME property for the new class. | |
* @param main The main class on which to base the built class | |
* @param extensions The set of extension classes which will be | |
augmented/aggregated to the built class. | |
* @param cfg Optional. Build configuration for the class (see description). | |
* @returns A custom class, created from the provided main and extension classes | |
*/ | |
build(name: Function, main: Function, extensions: Function[], cfg?: Object): Function; | |
/** | |
* Creates a new class (constructor function) which extends the base class passed i | |
* @param name The name of the newly created class. Used to define the NAME property for the new class. | |
* @param main The base class which the new class should extend. | |
This class needs to be Base or a class derived from base (e.g. Widget). | |
* @param extensions The list of extensions which will be mixed into the built class. | |
* @param px The set of prototype properties/methods to add to the built class. | |
* @param sx The set of static properties/methods to add to the built class. | |
* @returns The newly created class. | |
*/ | |
create(name: String, main: Function, extensions: Function[], px: Object, sx: Object): Function; | |
/** | |
* <p>Mixes in a list of extensions to an existing class.</p> | |
* @param main The existing class into which the extensions should be mixed. | |
The class needs to be Base or a class derived from Base (e.g. Widget) | |
* @param extensions The set of extension classes which will mixed into the existing main class. | |
* @returns The modified main class, with extensions mixed in. | |
*/ | |
mix(main: Function, extensions: Function[]): Function; | |
/** | |
* Alias for <a href="Plugin.Host.html#method_Plugin.Host.plug">Plugin.Host.plug</a | |
* @returns | |
*/ | |
/** | |
* Alias for <a href="Plugin.Host.html#method_Plugin.Host.unplug">Plugin.Host.unplu | |
* @returns | |
*/ | |
} | |
/** | |
* A Widget for displaying tabular data. Before feature modules are `use()`d, | |
this class is functional | |
*/ | |
class DataTable extends _DataTable.Base { | |
/** | |
* A Widget for displaying tabular data. Before feature modules are `use()`d, | |
this | |
undefined | |
*/ | |
/** | |
* Assigns the style width of the `<col>` representing the column identifed by | |
`id` | |
* @param id The column config object or key, name, or | |
index of a column in the host's `_displayColumns` array. | |
* @param width CSS width value. Numbers are treated as pixels | |
* @returns | |
*/ | |
setColumnWidth(id: Number | String | Object, width: Number | String): DataTable; | |
/** | |
* Gets the column configuration object for the given key, name, or index. For | |
nes | |
* @param name Key, "name", index, or index array to | |
identify the column | |
* @returns the column configuration object | |
*/ | |
getColumn(name: String | Number | Number[]): Object; | |
/** | |
* Returns the Model associated to the record `id`, `clientId`, or index (not | |
row i | |
* @param seed Record `id`, `clientId`, index, Node, or | |
identifier for a row or child element | |
* @returns | |
*/ | |
getRecord(seed: Number | String | Node): Model; | |
/** | |
* Returns the Model class of the instance's `data` attribute ModelList. If | |
not se | |
* @param val The currently configured value | |
* @returns | |
*/ | |
_getRecordType(val: Model): Model; | |
/** | |
* Hides the message node. | |
* @returns | |
*/ | |
/** | |
* Display the message node and set its content to `message`. If there is a | |
locali | |
* @param message The message name or message itself to display | |
* @returns | |
*/ | |
showMessage(message: String): DataTable; | |
/** | |
* Adds the column configuration to the DataTable's `columns` configuration. | |
If the | |
* @param config The new column configuration object | |
* @param index the insertion index | |
* @returns | |
*/ | |
addColumn(config: Object | String, index: Number | Number[]): DataTable; | |
/** | |
* Updates an existing column definition. Fires the `modifyColumn` event. | |
For exam | |
* @param name The column key, name, index, or | |
current configuration object | |
* @param config The new column configuration properties | |
* @returns | |
*/ | |
modifyColumn(name: String | Number | Number[] | Object, config: Object): DataTable; | |
/** | |
* Moves an existing column to a new location. Fires the `moveColumn` event. | |
The d | |
* @param name The column key, name, index, or | |
current configuration object | |
* @param index The destination index of the column | |
* @returns | |
*/ | |
moveColumn(name: String | Number | Number[] | Object, index: Number | Number[]): DataTable; | |
/** | |
* Removes an existing column. Fires the `removeColumn` event. | |
* @param name The column key, name, index, or | |
current configuration object | |
* @returns | |
*/ | |
removeColumn(name: String | Number | Number[] | Object): DataTable; | |
/** | |
* Adds a new record to the DataTable's `data` ModelList. Record data can be | |
an ob | |
* @param data The data or Model instance for the new record | |
* @param config Configuration to pass along | |
* @param callback Callback function for Model's `save()` | |
* @returns | |
*/ | |
addRow(data: Object, config: Object, callback: Function): DataTable; | |
/** | |
* Removes a record from the DataTable's `data` ModelList. The record can be | |
provi | |
* @param id The Model instance or identifier | |
* @param config Configuration to pass along | |
* @param callback Callback function for Model's `save()` | |
* @returns | |
*/ | |
removeRow(id: Object | String | Number, config: Object, callback: Function): DataTable; | |
/** | |
* Updates an existing record in the DataTable's `data` ModelList. The record | |
can | |
* @param id The Model instance or identifier | |
* @param data New data values for the Model | |
* @param config Configuration to pass along to `setAttrs()` | |
* @param callback Callback function for Model's `save()` | |
* @returns | |
*/ | |
modifyRow(id: Object | String | Number, data: Object, config: Object, callback: Function): DataTable; | |
/** | |
* Adds an array of new records to the DataTable's `data` ModelList. Record data | |
c | |
* @param data The data or Model instances to add | |
* @param config Configuration to pass along | |
* @param callback Callback function for each Model's `save()` | |
* @returns | |
*/ | |
addRows(data: Object[], config: Object, callback: Function): DataTable; | |
/** | |
* Scrolls a given row or cell into view if the table is scrolling. Pass the | |
`clie | |
* @param id A row clientId, row index, cell | |
coordinate array, id string, or Node | |
* @returns | |
*/ | |
scrollTo(id: String | Number | Number[] | Node): DataTable; | |
/** | |
* Sort the data in the `data` ModelList and refresh the table with the new | |
order. | |
* @param fields The field(s) to sort by | |
* @param payload Extra `sort` event payload you want to send along | |
* @returns | |
*/ | |
sort(fields: String | String[] | Object | Object[], payload: Object): DataTable; | |
/** | |
* Reverse the current sort direction of one or more fields currently being | |
sorted | |
* @param fields The field(s) to reverse sort order for | |
* @param payload Extra `sort` event payload you want to send along | |
* @returns | |
*/ | |
toggleSort(fields: String | String[], payload: Object): DataTable; | |
} | |
// ts does not allow referencing itself..base should not be in DataTable namespace! | |
namespace _DataTable { | |
/** | |
* The baseline implementation of a DataTable. This class should be used | |
primarily as a superclass for | |
*/ | |
class Base extends Widget { | |
/** | |
* The baseline implementation of a DataTable. This class should be used | |
primarily | |
undefined | |
*/ | |
/** | |
* Pass through to `delegate()` called from the `contentBox`. | |
* @param type the event type to delegate | |
* @param fn the callback function to execute. This function | |
will be provided the event object for the delegated event. | |
* @param spec a selector that must match the target of the | |
event or a function to test target and its parents for a match | |
* @param context optional argument that specifies what 'this' refers to | |
* @param args 0..n additional arguments to pass on to the callback | |
function. These arguments will be added after the event object. | |
* @returns the detach handle | |
*/ | |
delegate(type: String, fn: Function, spec: String | Function, context: Object, args: any): EventHandle; | |
/** | |
* Returns the `<td>` Node from the given row and column index. Alternately, | |
the ` | |
* @param seed Array of row and column indexes, or a Node that | |
is either the cell itself or a descendant of one. | |
* @param shift Offset by which to identify the returned | |
cell Node | |
* @returns | |
*/ | |
getCell(seed: Number[] | Node, shift: Number[] | String): Node; | |
/** | |
* Returns the `<tr>` Node from the given row index, Model, or Model's | |
`clientId`. | |
* @param id Row index, Model instance, or clientId | |
* @returns | |
*/ | |
getRow(id: Number | String | Model): Node; | |
/** | |
* Fires the `renderView` event, delegating UI updates to the configured View. | |
* @returns | |
*/ | |
} | |
} | |
/** | |
* Provides an API for managing an ordered list of Model instances. | |
In addition to providing convenien | |
*/ | |
export class ModelList extends Base { | |
/** | |
* Provides an API for managing an ordered list of Model instances. | |
In addition to | |
* @param config Config options. | |
undefined | |
*/ | |
constructor(config: Object); | |
/** | |
* Adds the specified model or array of models to this list. You may also pass | |
anot | |
* @param models Model or array of | |
models to add. May be existing model instances or hashes of model | |
attributes, in which case new model instances will be created from the | |
hashes. You may also pass a ModelList instance to add all the models it | |
contains. | |
* @param options Data to be mixed into the event facade of the | |
`add` event(s) for the added models. | |
* @returns Added model or array of added models. | |
*/ | |
add(models: Model | Model[] | ModelList | Object | Object[], options?: Object): Model | Model[]; | |
/** | |
* Define this method to provide a function that takes a model as a parameter | |
and r | |
* @param model Model being sorted. | |
* @returns Value by which the model should be sorted relative | |
to other models in this list. | |
*/ | |
comparator(model: Model): Number | String; | |
/** | |
* Creates or updates the specified model on the server, then adds it to this | |
list | |
* @param model Model to create. May be an existing model | |
instance or a hash of model attributes, in which case a new model instance | |
will be created from the hash. | |
* @param options Options to be passed to the model's `sync()` and | |
`set()` methods and mixed into the `create` and `add` event facades. | |
* @param callback Called when the sync operation finishes. | |
* @returns Created model. | |
*/ | |
create(model: Model | Object, options: Object, callback: Function): Model; | |
// shadowed | |
create(name: String, main: Function, extensions: Function[], px: Object, sx: Object): Function; | |
/** | |
* Executes the supplied function on each model in this list. | |
By default, the call | |
* @param callback Function to execute on each model. | |
* @param thisObj Object to use as the `this` object when executing | |
the callback. | |
* @returns | |
*/ | |
each(callback: Function, thisObj: Object): void; | |
/** | |
* Executes the supplied function on each model in this list. Returns an array | |
cont | |
* @param options Filter options. | |
* @param callback Function to execute on each model. | |
* @returns Array of models for which the callback function | |
returned a truthy value (empty if it never returned a truthy value). If | |
the `options.asList` option is truthy, a new ModelList instance will be | |
returned instead of an array. | |
*/ | |
filter(options: Object, callback: Function): Model[] | ModelList; | |
/** | |
* If _name_ refers to an attribute on this ModelList instance, returns the | |
value o | |
* @param name Attribute name or object property path. | |
* @returns Attribute value or array of attribute values. | |
*/ | |
get(name: String): any | any[]; | |
/** | |
* If _name_ refers to an attribute on this ModelList instance, returns the | |
HTML-es | |
* @param name Attribute name or object property path. | |
* @returns HTML-escaped value or array of HTML-escaped | |
values. | |
*/ | |
getAsHTML(name: String): String | String[]; | |
/** | |
* If _name_ refers to an attribute on this ModelList instance, returns the | |
URL-enc | |
* @param name Attribute name or object property path. | |
* @returns URL-encoded value or array of URL-encoded values. | |
*/ | |
getAsURL(name: String): String | String[]; | |
/** | |
* Returns the model with the specified _clientId_, or `null` if not found. | |
* @param clientId Client id. | |
* @returns Model, or `null` if not found. | |
*/ | |
getByClientId(clientId: String): Model; | |
/** | |
* Returns the model with the specified _id_, or `null` if not found. | |
Note that mo | |
* @param id Model id. | |
* @returns Model, or `null` if not found. | |
*/ | |
getById(id: String | Number): Model; | |
/** | |
* Calls the named method on every model in the list. Any arguments provided | |
after | |
* @param name Name of the method to call on each model. | |
* @param args* Zero or more arguments to pass to the invoked method. | |
* @returns Array of return values, indexed according to the index of | |
the model on which the method was called. | |
*/ | |
invoke(name: String, args: any): any[]; | |
/** | |
* Returns the model at the specified _index_. | |
* @param index Index of the model to fetch. | |
* @returns The model at the specified index, or `undefined` if there | |
isn't a model there. | |
*/ | |
item(index: Number): Model; | |
/** | |
* Loads this list of models from the server. | |
This method delegates to the `sync() | |
* @param options Options to be passed to `sync()` and to | |
`reset()` when adding the loaded models. It's up to the custom sync | |
implementation to determine what options it supports or requires, if any. | |
* @param callback Called when the sync operation finishes. | |
* @returns | |
*/ | |
load(options: Object, callback: Function): void; | |
/** | |
* Executes the specified function on each model in this list and returns an | |
array | |
* @param fn Function to execute on each model. | |
* @param thisObj `this` object to use when calling _fn_. | |
* @returns Array of return values from _fn_. | |
*/ | |
map(fn: Function, thisObj: Object): _ARRAY_; | |
/** | |
* Called to parse the _response_ when the list is loaded from the server. | |
This met | |
* @param response Server response. | |
* @returns Array of model attribute hashes. | |
*/ | |
parse(response: any): Object[]; | |
/** | |
* Removes the specified model or array of models from this list. You may also | |
pass | |
* @param models Models or indices of | |
models to remove. | |
* @param options Data to be mixed into the event facade of the | |
`remove` event(s) for the removed models. | |
* @returns Removed model or array of removed models. | |
*/ | |
remove(models: Model | Model[] | ModelList | Number | Number[], options: Object): Model | Model[]; | |
/** | |
* Completely replaces all models in the list with those specified, and fires a | |
sin | |
* @param models Models to add. May be existing | |
model instances or hashes of model attributes, in which case new model | |
instances will be created from the hashes. If a ModelList is passed, all | |
the models in that list will be added to this list. Calling `reset()` | |
without passing in any models will clear the list. | |
* @param options Data to be mixed into the event facade of the | |
`reset` event. | |
* @returns | |
*/ | |
reset(models: Model[] | ModelList | Object[], options: Object): void; | |
/** | |
* Executes the supplied function on each model in this list, and stops | |
iterating i | |
* @param callback Function to execute on each model. | |
* @param thisObj Object to use as the `this` object when executing | |
the callback. | |
* @returns `true` if the callback returned `true` for any item, | |
`false` otherwise. | |
*/ | |
some(callback: Function, thisObj: Object): Boolean; | |
/** | |
* Forcibly re-sorts the list. | |
Usually it shouldn't be necessary to call this meth | |
* @param options Data to be mixed into the event facade of the | |
`reset` event. | |
* @returns | |
*/ | |
sort(options: Object): void; | |
/** | |
* Override this method to provide a custom persistence implementation for this | |
lis | |
* @param action Sync action to perform. May be one of the following: | |
* `create`: Store a list of newly-created models for the first time. | |
* `delete`: Delete a list of existing models. | |
* `read` : Load a list of existing models. | |
* `update`: Update a list of existing models. | |
Currently, model lists only make use of the `read` action, but other | |
actions may be used in future versions. | |
* @param options Sync options. It's up to the custom sync | |
implementation to determine what options it supports or requires, if any. | |
* @param callback Called when the sync operation finishes. | |
* @returns | |
*/ | |
sync(action: String, options: Object, callback: Function): void; | |
/** | |
* Returns an array containing the models in this list. | |
* @returns Array containing the models in this list. | |
*/ | |
/** | |
* Returns an array containing attribute hashes for each model in this list, | |
suitab | |
* @returns Array of model attribute hashes. | |
*/ | |
} | |
/** | |
* Attribute-based data model with APIs for getting, setting, validating, and | |
syncing attribute values, | |
*/ | |
export class Model extends Base { | |
/** | |
* Attribute-based data model with APIs for getting, setting, validating, and | |
synci | |
undefined | |
*/ | |
/** | |
* Destroys this model instance and removes it from its containing lists, if | |
any. | |
* @param options Sync options. It's up to the custom sync | |
implementation to determine what options it supports or requires, if | |
any. | |
* @param callback Called after the model has been destroyed (and | |
deleted via the sync layer if `options.remove` is `true`). | |
* @returns | |
*/ | |
destroy(options: Object, callback: Function): void; | |
/** | |
* Returns a clientId string that's unique among all models on the current page | |
(ev | |
* @returns Unique clientId. | |
*/ | |
/** | |
* Returns the value of the specified attribute. | |
If the attribute's value is an ob | |
* @param name Attribute name or object property path. | |
* @returns Attribute value, or `undefined` if the attribute doesn't | |
exist. | |
*/ | |
get(name: String): any; | |
/** | |
* Returns an HTML-escaped version of the value of the specified string | |
attribute. | |
* @param name Attribute name or object property path. | |
* @returns HTML-escaped attribute value. | |
*/ | |
getAsHTML(name: String): String; | |
/** | |
* Returns a URL-encoded version of the value of the specified string | |
attribute. Th | |
* @param name Attribute name or object property path. | |
* @returns URL-encoded attribute value. | |
*/ | |
getAsURL(name: String): String; | |
/** | |
* Returns `true` if any attribute of this model has been changed since the | |
model w | |
* @returns `true` if this model has changed since it was last saved, | |
`false` otherwise. | |
*/ | |
/** | |
* Returns `true` if this model is "new", meaning it hasn't been saved since it | |
was | |
* @returns `true` if this model is new, `false` otherwise. | |
*/ | |
/** | |
* Loads this model from the server. | |
This method delegates to the `sync()` method | |
* @param options Options to be passed to `sync()` and to `set()` | |
when setting the loaded attributes. It's up to the custom sync | |
implementation to determine what options it supports or requires, if any. | |
* @param callback Called when the sync operation finishes. | |
* @returns | |
*/ | |
load(options: Object, callback: Function): void; | |
/** | |
* Called to parse the _response_ when the model is loaded from the server. | |
This me | |
* @param response Server response. | |
* @returns Attribute hash. | |
*/ | |
parse(response: any): Object; | |
/** | |
* Saves this model to the server. | |
This method delegates to the `sync()` method to | |
* @param options Options to be passed to `sync()` and to `set()` | |
when setting synced attributes. It's up to the custom sync implementation | |
to determine what options it supports or requires, if any. | |
* @param callback Called when the sync operation finishes. | |
* @returns | |
*/ | |
save(options: Object, callback: Function): void; | |
/** | |
* Sets the value of a single attribute. If model validation fails, the | |
attribute w | |
* @param name Attribute name or object property path. | |
* @param value Value to set. | |
* @param options Data to be mixed into the event facade of the | |
`change` event(s) for these attributes. | |
* @returns | |
*/ | |
set(name: String, value: any, options: Object): void; | |
/** | |
* Sets the values of multiple attributes at once. If model validation fails, | |
the a | |
* @param attributes Hash of attribute names and values to set. | |
* @param options Data to be mixed into the event facade of the | |
`change` event(s) for these attributes. | |
* @returns | |
*/ | |
setAttrs(attributes: Object, options: Object): void; | |
/** | |
* Override this method to provide a custom persistence implementation for this | |
mod | |
* @param action Sync action to perform. May be one of the following: | |
* `create`: Store a newly-created model for the first time. | |
* `delete`: Delete an existing model. | |
* `read` : Load an existing model. | |
* `update`: Update an existing model. | |
* @param options Sync options. It's up to the custom sync | |
implementation to determine what options it supports or requires, if any. | |
* @param callback Called when the sync operation finishes. | |
* @returns | |
*/ | |
sync(action: String, options: Object, callback: Function): void; | |
/** | |
* Returns a copy of this model's attributes that can be passed to | |
`Y.JSON.stringif | |
* @returns Copy of this model's attributes. | |
*/ | |
/** | |
* Reverts the last change to the model. | |
If an _attrNames_ array is provided, then | |
* @param attrNames Array of specific attribute names to revert. If | |
not specified, all attributes modified in the last change will be | |
reverted. | |
* @param options Data to be mixed into the event facade of the | |
change event(s) for these attributes. | |
* @returns | |
*/ | |
undo(attrNames: String[], options: Object): void; | |
/** | |
* Override this method to provide custom validation logic for this model. | |
While a | |
* @param attrs Attribute hash containing all model attributes to | |
be validated. | |
* @param callback Validation callback. Call this function when your | |
validation logic finishes. To trigger a validation failure, pass any | |
value as the first argument to the callback (ideally a meaningful | |
validation error of some kind). | |
* @returns | |
*/ | |
validate(attrs: Object, callback: Function): void; | |
} | |
/** | |
* Provides utility methods for working with arrays. Additional array helpers can | |
be found in the `coll | |
*/ | |
export class Array { | |
/** | |
* Provides utility methods for working with arrays. Additional array helpers can | |
b | |
* @param thing The thing to arrayify. | |
* @param startIndex If non-zero and _thing_ is an array or array-like | |
collection, a subset of items starting at the specified index will be | |
returned. | |
* @param force If `true`, _thing_ will be treated as an | |
array-like collection no matter what. | |
undefined | |
*/ | |
constructor(thing: any, startIndex: Number, force: Boolean); | |
/** | |
* Returns the index of the last item in the array that contains the specified | |
valu | |
* @param a Array to search in. | |
* @param val Value to search for. | |
* @param fromIndex Index at which to start searching backwards. | |
Defaults to the array's length - 1. If negative, it will be taken as an offset | |
from the end of the array. If the calculated index is less than 0, the array | |
will not be searched and `-1` will be returned. | |
* @returns Index of the item that contains the value, or `-1` if not | |
found. | |
*/ | |
lastIndexOf(a: Array, val: any, fromIndex: Number): Number; | |
/** | |
* Returns a copy of the input array with duplicate items removed. | |
Note: If the in | |
* @param array Array to dedupe. | |
* @param testFn Custom function to use to test the equality of two | |
values. A truthy return value indicates that the values are equal. A falsy | |
return value indicates that the values are not equal. | |
* @returns Copy of the input array with duplicate items removed. | |
*/ | |
unique(array: Array, testFn: Function): Array; | |
/** | |
* Executes the supplied function on each item in the array. Returns a new array | |
co | |
* @param a Array to filter. | |
* @param f Function to execute on each item. | |
* @param o Optional context object. | |
* @returns Array of items for which the supplied function returned a | |
truthy value (empty if it never returned a truthy value). | |
*/ | |
filter(a: Array, f: Function, o?: Object): Array; | |
/** | |
* The inverse of `Array.filter()`. Executes the supplied function on each item. | |
Re | |
* @param a the array to iterate. | |
* @param f the function to execute on each item. | |
* @param o Optional context object. | |
* @returns The items for which the supplied function returned `false`. | |
*/ | |
reject(a: Array, f: Function, o?: Object): Array; | |
/** | |
* Executes the supplied function on each item in the array. Iteration stops if the | |
* @param a the array to iterate. | |
* @param f the function to execute on each item. | |
* @param o Optional context object. | |
* @returns `true` if every item in the array returns `true` from the | |
supplied function, `false` otherwise. | |
*/ | |
every(a: Array, f: Function, o?: Object): Boolean; | |
/** | |
* Executes the supplied function on each item in the array and returns a new array | |
* @param a the array to iterate. | |
* @param f the function to execute on each item. | |
* @param o Optional context object. | |
* @returns A new array containing the return value of the supplied function | |
for each item in the original array. | |
*/ | |
map(a: Array, f: Function, o?: Object): Array; | |
/** | |
* Executes the supplied function on each item in the array, "folding" the array | |
in | |
* @param a Array to iterate. | |
* @param init Initial value to start with. | |
* @param f Function to execute on each item. This function should | |
update and return the value of the computation. It will receive the following | |
arguments: | |
* @param o Optional context object. | |
* @returns Final result from iteratively applying the given function to each | |
element in the array. | |
*/ | |
reduce(a: Array, init: any, f: Function, o?: Object): any; | |
/** | |
* Executes the supplied function on each item in the array, searching for the | |
firs | |
* @param a the array to search. | |
* @param f the function to execute on each item. Iteration is stopped | |
as soon as this function returns `true`. | |
* @param o Optional context object. | |
* @returns the first item that the supplied function returns `true` for, | |
or `null` if it never returns `true`. | |
*/ | |
find(a: Array, f: Function, o?: Object): Object; | |
/** | |
* Iterates over an array, returning a new array of all the elements that match the | |
* @param a Array to iterate over. | |
* @param pattern Regular expression to test against each item. | |
* @returns All the items in the array that produce a match against the | |
supplied regular expression. If no items match, an empty array is returned. | |
*/ | |
grep(a: Array, pattern: RegExp): Array; | |
/** | |
* Partitions an array into two new arrays, one with the items for which the | |
suppli | |
* @param a Array to iterate over. | |
* @param f Function to execute for each item in the array. It will | |
receive the following arguments: | |
* @param o Optional execution context. | |
* @returns An object with two properties: `matches` and `rejects`. Each is | |
an array containing the items that were selected or rejected by the test | |
function (or an empty array if none). | |
*/ | |
partition(a: Array, f: Function, o?: Object): Object; | |
/** | |
* Creates an array of arrays by pairing the corresponding elements of two arrays | |
t | |
* @param a Array to iterate over. | |
* @param a2 Another array whose values will be paired with values of the | |
first array. | |
* @returns An array of arrays formed by pairing each element of the first | |
array with an item in the second array having the corresponding index. | |
*/ | |
zip(a: Array, a2: Array): Array; | |
/** | |
* Flattens an array of nested arrays at any abitrary depth into a single, flat | |
arr | |
* @param a Array with nested arrays to flatten. | |
* @returns An array whose nested arrays have been flattened. | |
*/ | |
flatten(a: Array): Array; | |
/** | |
* Executes a named method on each item in an array of objects. Items in the array | |
* @param items Array of objects supporting the named method. | |
* @param name the name of the method to execute on each item. | |
* @param args* Any number of additional args are passed as parameters to | |
the execution of the named method. | |
* @returns All return values, indexed according to the item index. | |
*/ | |
invoke(items: Array, name: String, args: any): Array; | |
/** | |
* Dedupes an array of strings, returning an array that's guaranteed to contain | |
onl | |
* @param array Array of strings or numbers to dedupe. | |
* @returns Copy of _array_ containing no duplicate values. | |
*/ | |
dedupe(array: String[] | Number[]): Array; | |
/** | |
* Executes the supplied function on each item in the array. This method wraps | |
the | |
* @param array Array to iterate. | |
* @param fn Function to execute on each item in the array. The function | |
will receive the following arguments: | |
* @param thisObj `this` object to use when calling _fn_. | |
* @returns The YUI instance. | |
*/ | |
each(array: Array, fn: Function, thisObj: Object): YUI; | |
/** | |
* Alias for `each()`. | |
* @returns | |
*/ | |
/** | |
* Returns an object using the first array as keys and the second as values. If | |
the | |
* @param keys Array of strings to use as keys. | |
* @param values Array to use as values. | |
* @returns Hash using the first array as keys and the second as values. | |
*/ | |
hash(keys: String[], values: Array): Object; | |
/** | |
* Returns the index of the first item in the array that's equal (using a strict | |
eq | |
* @param array Array to search. | |
* @param value Value to search for. | |
* @param from The index at which to begin the search. | |
* @returns Index of the item strictly equal to _value_, or `-1` if not | |
found. | |
*/ | |
indexOf(array: Array, value: any, from: Number): Number; | |
/** | |
* Numeric sort convenience function. | |
The native `Array.prototype.sort()` function | |
* @param a First value to compare. | |
* @param b Second value to compare. | |
* @returns Difference between _a_ and _b_. | |
*/ | |
numericSort(a: Number, b: Number): Number; | |
/** | |
* Executes the supplied function on each item in the array. Returning a truthy | |
val | |
* @param array Array to iterate over. | |
* @param fn Function to execute on each item. The function will receive | |
the following arguments: | |
* @param thisObj `this` object to use when calling _fn_. | |
* @returns `true` if the function returns a truthy value on any of the | |
items in the array; `false` otherwise. | |
*/ | |
some(array: Array, fn: Function, thisObj: Object): Boolean; | |
/** | |
* Evaluates _obj_ to determine if it's an array, an array-like collection, or | |
some | |
* @param obj Object to test. | |
* @returns A number indicating the results of the test: | |
* 0: Neither an array nor an array-like collection. | |
* 1: Real array. | |
* 2: Array-like collection. | |
*/ | |
test(obj: Object): Number; | |
} | |
/** | |
* Provides console log capability and exposes a custom event for | |
* console implementations. This module is a `core` YUI module, | |
* <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>. | |
* | |
* @module yui | |
* @submodule yui-log | |
*/ | |
export class Log { | |
/** | |
* If the 'debug' config is true, a 'yui:log' event will be dispatched, which the Console widget and anything else can consume. If the 'useBrowserConsole' config is true, it will write to the browser console if available. YUI-specific log messages will only be present in the -debug versions of the JS files. The build system is supposed to remove log statements from the raw and minified versions of the files. | |
*@param msg The message to log. | |
*@param cat The log category for the message. Default categories are "info", "warn", "error", time". Custom categories can be used as well. (opt). | |
*@param src The source of the the message (opt). | |
*@param silent If true, the log event won't fire. | |
*@returns YUI instance. | |
*/ | |
log(msg: String, cat: String, src: String, silent: boolean): YUI; | |
/** | |
* Write a system message. This message will be preserved in the minified and raw versions of the YUI files, unlike log statements. | |
*@param msg The message to log. | |
*@param cat The log category for the message. Default categories are "info", "warn", "error", time". Custom categories can be used as well. (opt). | |
*@param src The source of the the message (opt). | |
*@param silent If true, the log event won't fire. | |
*@returns YUI instance. | |
*/ | |
message(msg: String, cat: String, src: String, silent: boolean): YUI; | |
} | |
/** | |
* Provides core language utilites and extensions used throughout YUI. | |
*/ | |
export class Lang { | |
/** | |
* Provides core language utilites and extensions used throughout YUI. | |
undefined | |
*/ | |
/** | |
* Determines whether or not the provided item is an array. | |
Returns `false` for ar | |
* @param o The object to test. | |
* @returns true if o is an array. | |
*/ | |
isArray(o: any): Boolean; | |
/** | |
* Determines whether or not the provided item is a boolean. | |
* @param o The object to test. | |
* @returns true if o is a boolean. | |
*/ | |
isBoolean(o: any): Boolean; | |
/** | |
* Determines whether or not the supplied item is a date instance. | |
* @param o The object to test. | |
* @returns true if o is a date. | |
*/ | |
isDate(o: any): Boolean; | |
/** | |
* <p> | |
Determines whether or not the provided item is a function. | |
Note: Internet Ex | |
* @param o The object to test. | |
* @returns true if o is a function. | |
*/ | |
isFunction(o: any): Boolean; | |
/** | |
* Determines whether or not the provided item is null. | |
* @param o The object to test. | |
* @returns true if o is null. | |
*/ | |
isNull(o: any): Boolean; | |
/** | |
* Determines whether or not the provided item is a legal number. | |
* @param o The object to test. | |
* @returns true if o is a number. | |
*/ | |
isNumber(o: any): Boolean; | |
/** | |
* Determines whether or not the provided item is of type object | |
or function. Note | |
* @param o The object to test. | |
* @param failfn fail if the input is a function. | |
* @returns true if o is an object. | |
*/ | |
isObject(o: any, failfn: Boolean): Boolean; | |
/** | |
* Determines whether or not the provided value is a regexp. | |
* @param value The value or object to test. | |
* @returns true if value is a regexp. | |
*/ | |
isRegExp(value: any): Boolean; | |
/** | |
* Determines whether or not the provided item is a string. | |
* @param o The object to test. | |
* @returns true if o is a string. | |
*/ | |
isString(o: any): Boolean; | |
/** | |
* Determines whether or not the provided item is undefined. | |
* @param o The object to test. | |
* @returns true if o is undefined. | |
*/ | |
isUndefined(o: any): Boolean; | |
/** | |
* A convenience method for detecting a legitimate non-null value. | |
Returns false fo | |
* @param o The item to test. | |
* @returns true if it is not null/undefined/NaN || false. | |
*/ | |
isValue(o: any): Boolean; | |
/** | |
* Returns the current time in milliseconds. | |
* @returns Current time in milliseconds. | |
*/ | |
/** | |
* Performs `{placeholder}` substitution on a string. The object passed as the | |
seco | |
* @param s String to be modified. | |
* @param o Object containing replacement values. | |
* @returns the substitute result. | |
*/ | |
sub(s: String, o: Object): String; | |
/** | |
* Returns a string without any leading or trailing whitespace. If | |
the input is no | |
* @param s the string to trim. | |
* @returns the trimmed string. | |
*/ | |
trim(s: String): String; | |
/** | |
* Returns a string without any leading whitespace. | |
* @param s the string to trim. | |
* @returns the trimmed string. | |
*/ | |
trimLeft(s: String): String; | |
/** | |
* Returns a string without any trailing whitespace. | |
* @param s the string to trim. | |
* @returns the trimmed string. | |
*/ | |
trimRight(s: String): String; | |
/** | |
* Returns one of the following strings, representing the type of the item passed | |
i | |
* @param o the item to test. | |
* @returns the detected type. | |
*/ | |
type(o: any): String; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment