From f9b6d77a784924e7e005e1eeba775defa9d292f6 Mon Sep 17 00:00:00 2001 From: Fokke Zandbergen Date: Sun, 13 Oct 2013 15:54:05 +0200 Subject: [PATCH] Version 1.4 introducing events --- LICENSE.txt | 13 ------------- README.md | 30 ++++++++++++++++++++++++++---- controllers/widget.js | 6 +++--- widget.json | 2 +- 4 files changed, 30 insertions(+), 21 deletions(-) delete mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index db405df..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2013 Fokke Zandbergen - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index 202c33e..92ddd60 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ The *CachedImageView* widget implements the [best practice of caching remote ima * Provide a seperate URL for the image to use on IOS retina devices. * Provide a local filename to be used instead of the MD5 hash of the URL. * Provide an extension for the local file if the remote doesn't have one. +* Eventing. ## Future work * Provide a subdirectory to save the image under. @@ -25,7 +26,7 @@ The *CachedImageView* widget implements the [best practice of caching remote ima ```javascript … "dependencies": { - "nl.fokkezb.cachedImageView":"1.3" + "nl.fokkezb.cachedImageView":"1.4" } ``` @@ -33,7 +34,7 @@ The *CachedImageView* widget implements the [best practice of caching remote ima ```xml +id="civ" image="http://url.to/image.png" onClick="handleClick" /> ``` * Optionally add any of the additional parameters as attributes. @@ -56,6 +57,9 @@ The only required parameter is the `image` parameter. All parameters are passed | applyProperties | *object* | Alias for `init` | | setImage | *string* | Alias for calling `init` with only an `image` parameter | | getImage | *bool* returnPath | Return the (path to the) local image. Calling this method before it has been cached will return `undefined` | +| on / addEventListener | *string* name, *function* callback | Add an eventlistener | +| off / removeEventListener | *string* name, *function* callback | Remove an eventlistener | +| trigger / fireEvent | *string* name, *object* args | Fire an event | ## Properties @@ -88,9 +92,27 @@ You can style the resulting *Ti.UI.ImageView* by applying the styles to the ` +Copyright 2013 Fokke Zandbergen + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + diff --git a/controllers/widget.js b/controllers/widget.js index 0e7f53e..f291376 100644 --- a/controllers/widget.js +++ b/controllers/widget.js @@ -117,14 +117,14 @@ exports.getImage = getImage; exports.init = init; exports.applyProperties = init; -exports.on = function(name, callback) { +exports.on = exports.addEventListener = function(name, callback) { return $.imageView.addEventListener(name, callback); }; -exports.off = function(name, callback) { +exports.off = exports.removeEventListener = function(name, callback) { return $.imageView.removeEventListener(name, callback); }; -exports.trigger = function(name, e) { +exports.trigger = exports.fireEvent = function(name, e) { return $.imageView.fireEvent(name, e); }; diff --git a/widget.json b/widget.json index 0b84d80..77bfcbe 100644 --- a/widget.json +++ b/widget.json @@ -3,7 +3,7 @@ "name": "nl.fokkezb.cachedImageView", "description" : "Alloy version of the best practice to cache remote images locally.", "author": "Fokke Zandbergen", - "version": "1.3.1", + "version": "1.4", "copyright":"Copyright (c) 2012", "license":"Public Domain", "min-alloy-version": "1.0",