Permalink
Browse files

Commits a temp branch for work in another station

  • Loading branch information...
1 parent 9a56721 commit c55239e306ed285c9beb25c7be22b2c326aeabc7 Xavier Cambar committed Jul 13, 2011
Showing with 79 additions and 31 deletions.
  1. +1 −0 .gitignore
  2. +17 −0 .project
  3. +10 −0 bootstrap.js
  4. +16 −0 examples/NoSQL.js
  5. +31 −0 lib/NoSQL/model/Document.js
  6. +4 −31 lib/n-ext.js
View
@@ -0,0 +1 @@
+lib/Ext
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>n-ext</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.aptana.projects.webnature</nature>
+ </natures>
+</projectDescription>
View
@@ -0,0 +1,10 @@
+require.paths.unshift('./lib');
+
+var sencha = require('n-ext');
+sencha.setDebug(true);
+sencha.setPath(__dirname + '/lib/Ext/src/');
+var E = sencha.bootstrapCore(true);
+//sencha.bootstrapCore(false); //with the param set to false, Ext is available app-wide
+
+//Ext.Loader.setPath('Xc', __PROJECT_DIR + '/library/Xc');
+//Ext.Loader.setPath('Tab', __PROJECT_DIR + '/library/Tab');
View
@@ -0,0 +1,16 @@
+require.paths.unshift('./../lib');
+
+var sencha = require('n-ext');
+sencha.setPath(__dirname + '/../lib/Ext/src/');
+sencha.bootstrapCore();
+
+Ext.Loader.setPath('NoSQL', __dirname + '/../lib/NoSQL');
+
+var model = Ext.create('NoSQL.model.Document', {
+ 'name' : 'XC'
+});
+
+model.save();
+
+var store = new Ext.data.Store({model: 'NoSQL.model.Document'});
+console.log(store.load());
@@ -0,0 +1,31 @@
+var data = {
+ docs: [
+ {
+ id: 1,
+ name: 'Ed Spencer'
+ },
+ {
+ id: 2,
+ name: 'Abe Elias'
+ }
+ ]
+};
+
+Ext.define('NoSQL.model.Document', {
+ requires: [
+ 'Ext.data.proxy.Memory'
+ ],
+ extend: 'Ext.data.Model',
+ fields: [
+ {name: 'id', type: 'string'},
+ {name: 'name', type: 'string'}
+ ],
+ proxy: {
+ type: 'memory',
+ reader: {
+ type: 'json',
+ root: 'docs'
+ }
+ }
+});
+
View
@@ -43,8 +43,11 @@ var nExtLoader = function() {
Ext.Loader.config.enabled = true;
Ext.Loader.setPath('Ext', _prefix);
- Ext.require = _overrideRequire(Ext.require);
+ global.__defineGetter__('window', function() {
+ return {};
+ });
Ext.require('Ext.ModelManager');
+ Ext.require('Ext.data.Store');
if (sandbox === true) {
var _ext = Ext;
delete(Ext);
@@ -53,36 +56,6 @@ var nExtLoader = function() {
};
/**
- * The method encapsulates the original Ext.require to stand the use of
- * the global object window (most probably not defined in SSJS, but used in Loader.js)
- * If window is already defined, it is cloned and restored after after the call.
- * But it is highly probable tha if window is defined, the loading will fail due to
- * context checks in ExtJS.
- * Any data modified in window during the execution of Ext.require are logged
- * to the console for the record
- */
- var _overrideRequire = function(f) {
- return function() {
- if (typeof(window) !== 'undefined') { //Window has NO REASON to be used in SSJS...
- var _w = Ext.clone(window);
- }
- window = {};
- var res = f.apply(this, arguments);
- if (_debug) {
- console.log('window has been set/updated');
- console.log(window);
- }
- if (_w) {
- window = _w;
- } else {
- delete window;
- }
- delete _w;
- return res;
- }
- }
-
- /**
* Defines where the Ext lirary is located in the file structure
*/
this.setPath = function(_p) {

0 comments on commit c55239e

Please sign in to comment.