Comparing version 0.3.1 to 0.3.2
import { ModelEventDispatcher } from "../ModelEventDispatcher"; | ||
import { CollectionEvent } from "./events/CollectionEvent"; | ||
/** | ||
* ArrayCollection is one of two collection types which is used as a model. | ||
* | ||
* it Dispatches events based on type of action being taken on the collection. | ||
*/ | ||
export declare class ArrayCollection<T> extends ModelEventDispatcher { | ||
private _sortFunction; | ||
private _filterFunction; | ||
/** | ||
* | ||
* @param value | ||
*/ | ||
sortFunction: (item1: T, item2: T) => number; | ||
@@ -7,0 +16,0 @@ filterFunction: (item: T) => boolean; |
@@ -10,2 +10,7 @@ "use strict"; | ||
var CollectionEvent_1 = require("./events/CollectionEvent"); | ||
/** | ||
* ArrayCollection is one of two collection types which is used as a model. | ||
* | ||
* it Dispatches events based on type of action being taken on the collection. | ||
*/ | ||
var ArrayCollection = (function (_super) { | ||
@@ -23,2 +28,6 @@ __extends(ArrayCollection, _super); | ||
}, | ||
/** | ||
* | ||
* @param value | ||
*/ | ||
set: function (value) { | ||
@@ -25,0 +34,0 @@ this._sortFunction = value; |
import { REvent } from "./event"; | ||
export declare class ModelEventDispatcher { | ||
protected handlers: any; | ||
dispatchEvent(event: string, ...args: any[]): void; | ||
dispatchEvent(event: REvent): void; | ||
addEventListener(eventName: string, callback: (...args) => any, context?: any): void; | ||
addEventListener(eventName: string, callback: (p1: REvent) => any, context?: any): void; | ||
removeEventListener(eventName: string, callback: (...args) => any): void; | ||
removeEventListener(eventName: string, callback: (p1: REvent) => any): void; | ||
@@ -7,0 +10,0 @@ removeAllEventListeners(eventName: string): void; |
@@ -28,10 +28,23 @@ "use strict"; | ||
ModelEventDispatcher.prototype.dispatchEvent = function (event) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
var handlers; | ||
handlers = this.getHandlers(event.type); | ||
var eventType; | ||
if (typeof event == "string") | ||
eventType = event; | ||
else | ||
eventType = event.type; | ||
handlers = this.getHandlers(eventType); | ||
if (handlers) { | ||
for (var i = 0; i < handlers.length; i++) { | ||
var handler = handlers[i]; | ||
handler.handler.call(handler.context, event); | ||
if (typeof event == "string") | ||
(_a = handler.handler).call.apply(_a, [handler.context].concat(args)); | ||
else | ||
handler.handler.call(handler.context, event); | ||
} | ||
} | ||
var _a; | ||
}; | ||
@@ -38,0 +51,0 @@ ModelEventDispatcher.prototype.addEventListener = function (eventName, callback, context) { |
{ | ||
"name": "ramajs", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"author": { | ||
@@ -32,2 +32,3 @@ "name": "" | ||
"steal": "0.16.22", | ||
"typedoc": "^0.4.4", | ||
"typescript": "1.8.10", | ||
@@ -62,2 +63,3 @@ "typings": "1.3.1" | ||
"build-release": "npm run build release", | ||
"generate-docs": "typedoc --out docs src --mode file --module commonjs --target ES5", | ||
"clean": "node scripts/clean.js", | ||
@@ -64,0 +66,0 @@ "coverage": "node scripts/coverage.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90769
2362
22