Permalink
Browse files

gallery-2011.04.06-19-44 solmsted gallery-recordset-storage-lite

  • Loading branch information...
1 parent 16e530f commit d3cbfdb4d31aaf2187e5f77e6b11d26c9161f3c9 YUI Builder committed Apr 6, 2011
@@ -0,0 +1,29 @@
+# Recordset Storage Lite Plugin Build Properties
+
+# As long as the 'builder' project is cloned to the default folder
+# next to the 'yui3-gallery' project folder, the 'builddir' property does not
+# need to be changed
+#
+# If the 'builder' project is checked out to an alternate location, this
+# property should be updated to point to the checkout location.
+builddir=../../../builder/componentbuild
+
+# The name of the component. E.g. event, attribute, widget
+component=gallery-recordset-storage-lite
+
+# The list of files which should be concatenated to create the component
+# NOTE: For a css component. (e.g. cssfonts, cssgrids etc.) use component.cssfiles instead.
+# component.jsfiles=recordset-storage-lite.js, recordset-storage-liteHelperClass.js, recordset-storage-liteSubComponentClass.js
+component.jsfiles=recordset-storage-lite.js
+
+# The list of modules this component. requires. Used to set up the Y.add module call for YUI 3.
+component.requires=gallery-storage-lite,plugin
+
+# The list of modules this component. supersedes. Used to set up the Y.add module call for YUI 3.
+#component.supersedes=
+
+# The list of modules that are optional for this module. Used to set up the Y.add module call for YUI 3.
+#component.optional=
+# If your module has a skin file, set this flag to "true"
+#component.skinnable=false;
+#component.skinnable=true;
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- YUI 3 Gallery Component Build File -->
+<project name="Recordset Storage Lite Plugin" default="local">
+ <description>Recordset Storage Lite Plugin Build File</description>
+ <property file="build.properties" />
+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
+</project>
@@ -0,0 +1,37 @@
+'use strict';
+
+var _class;
+
+_class = function (config) {
+ _class.superclass.constructor.call(this, config);
+};
+
+_class.NAME = 'RecordsetStorageLite';
+
+_class.NS = 'storageLite';
+
+Y.extend(_class, Y.Plugin.Base, {
+ initializer: function () {
+ this.publish('failure');
+ this.publish('store');
+ },
+ store: function (key) {
+ Y.StorageLite.on('storage-lite:ready', function () {
+ var host = this.get('host'),
+ records = host.getRecordsByIndex(0, host.getLength());
+
+ Y.each(records, function (record, index, records) {
+ records[index] = record.getValue();
+ });
+
+ try {
+ Y.StorageLite.setItem(key, records, true);
+ this.fire('store', {}, key, records);
+ } catch (e) {
+ this.fire('failure', {}, e);
+ }
+ }, this);
+ }
+});
+
+Y.Plugin.RecordsetStorageLite = _class;

0 comments on commit d3cbfdb

Please sign in to comment.