Browse Source

0.6.0 - rename to VueJS

Evan You 12 years ago
parent
commit
218557cdec
7 changed files with 49 additions and 68 deletions
  1. 2 2
      .gitignore
  2. 3 0
      .npmignore
  3. 11 11
      README.md
  4. 23 23
      dist/vue.js
  5. 0 0
      dist/vue.min.js
  6. 10 2
      src/emitter.js
  7. 0 30
      test/vue.test-cov.js

+ 2 - 2
.gitignore

@@ -3,5 +3,5 @@
 node_modules
 components
 explorations
-test/seed.test.js
-test/seed.test-cov.js
+test/vue.test.js
+test/vue.test-cov.js

+ 3 - 0
.npmignore

@@ -6,6 +6,9 @@ components
 node_modules
 .jshintrc
 .gitignore
+.travis.yml
+.sass-cache
+.npmignore
 bower.json
 component.json
 Gruntfile.js

+ 11 - 11
README.md

@@ -1,8 +1,8 @@
-# Seed.js
+# VueJS
 
-Modular & Lightweight JavaScript MVVM
+Data-driven, modular & lightweight ViewModels
 
-[![Build Status](https://travis-ci.org/yyx990803/seed.png?branch=master)](https://travis-ci.org/yyx990803/seed)
+[![Build Status](https://travis-ci.org/yyx990803/vue.png?branch=master)](https://travis-ci.org/yyx990803/vue)
 
 ## Features
 
@@ -27,15 +27,15 @@ Modular & Lightweight JavaScript MVVM
 
 **Component**
 
-    $ component install yyx990803/seed
+    $ component install yyx990803/vue
 
 **Browserify**
 
-    $ npm install seed-mvvm
+    $ npm install vue
 
 **Bower**
 
-    $ bower install seed
+    $ bower install vue
 
 **Module Loaders, e.g. RequireJS, SeaJS**
 
@@ -43,7 +43,7 @@ Built versions in `/dist` or installed via Bower can be used directly as a Commo
 
 **Standalone**
 
-Simply include a built version in `/dist` or installed via Bower with a script tag. `seed` will be registered as a global variable.
+Simply include a built version in `/dist` or installed via Bower with a script tag. `Vue` will be registered as a global variable.
 
 ## Development
 
@@ -74,20 +74,20 @@ $ grunt test
 **HTML**
 
 ~~~ html
-<div id="demo" sd-on="click:changeText">
-    <p sd-text="hello"></p>
+<div id="demo" v-on="click:changeText">
+    <p v-text="hello"></p>
 </div>
 ~~~
 
 **JavaScript**
 
 ~~~ js
-new Seed({
+new Vue({
     el: '#demo',
     scope: {
         hello: 'Hello World!',
         changeText: function () {
-            this.hello = 'Hello Seed!'
+            this.hello = 'Hello VueJS!'
         }
     }
 })

+ 23 - 23
dist/vue.js

@@ -200,23 +200,8 @@ require.relative = function(parent) {
 
   return localRequire;
 };
-require.register("component-indexof/index.js", function(exports, require, module){
-module.exports = function(arr, obj){
-  if (arr.indexOf) return arr.indexOf(obj);
-  for (var i = 0; i < arr.length; ++i) {
-    if (arr[i] === obj) return i;
-  }
-  return -1;
-};
-});
 require.register("component-emitter/index.js", function(exports, require, module){
 
-/**
- * Module dependencies.
- */
-
-var index = require('indexof');
-
 /**
  * Expose `Emitter`.
  */
@@ -257,7 +242,8 @@ function mixin(obj) {
  * @api public
  */
 
-Emitter.prototype.on = function(event, fn){
+Emitter.prototype.on =
+Emitter.prototype.addEventListener = function(event, fn){
   this._callbacks = this._callbacks || {};
   (this._callbacks[event] = this._callbacks[event] || [])
     .push(fn);
@@ -283,7 +269,7 @@ Emitter.prototype.once = function(event, fn){
     fn.apply(this, arguments);
   }
 
-  fn._off = on;
+  on.fn = fn;
   this.on(event, on);
   return this;
 };
@@ -300,7 +286,8 @@ Emitter.prototype.once = function(event, fn){
 
 Emitter.prototype.off =
 Emitter.prototype.removeListener =
-Emitter.prototype.removeAllListeners = function(event, fn){
+Emitter.prototype.removeAllListeners =
+Emitter.prototype.removeEventListener = function(event, fn){
   this._callbacks = this._callbacks || {};
 
   // all
@@ -320,8 +307,14 @@ Emitter.prototype.removeAllListeners = function(event, fn){
   }
 
   // remove specific handler
-  var i = index(callbacks, fn._off || fn);
-  if (~i) callbacks.splice(i, 1);
+  var cb;
+  for (var i = 0; i < callbacks.length; i++) {
+    cb = callbacks[i];
+    if (cb === fn || cb.fn === fn) {
+      callbacks.splice(i, 1);
+      break;
+    }
+  }
   return this;
 };
 
@@ -548,9 +541,17 @@ try {
     // unable to parse the dependency, thus preventing it from
     // stopping the compilation after a failed lookup.
     Emitter = require(componentEmitter)
-} catch (e) {}
+} catch (e) {
+    Emitter = require('events').EventEmitter
+    Emitter.prototype.off = function () {
+        var method = arguments.length > 1
+            ? this.removeListener
+            : this.removeAllListeners
+        return method.apply(this, arguments)
+    }
+}
 
-module.exports = Emitter || require('events').EventEmitter
+module.exports = Emitter
 });
 require.register("vue/src/config.js", function(exports, require, module){
 module.exports = {
@@ -3170,7 +3171,6 @@ module.exports = {
 });
 require.alias("component-emitter/index.js", "vue/deps/emitter/index.js");
 require.alias("component-emitter/index.js", "emitter/index.js");
-require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js");
 
 require.alias("vue/src/main.js", "vue/index.js");if (typeof exports == "object") {
   module.exports = require("vue");

File diff suppressed because it is too large
+ 0 - 0
dist/vue.min.js


+ 10 - 2
src/emitter.js

@@ -7,6 +7,14 @@ try {
     // unable to parse the dependency, thus preventing it from
     // stopping the compilation after a failed lookup.
     Emitter = require(componentEmitter)
-} catch (e) {}
+} catch (e) {
+    Emitter = require('events').EventEmitter
+    Emitter.prototype.off = function () {
+        var method = arguments.length > 1
+            ? this.removeListener
+            : this.removeAllListeners
+        return method.apply(this, arguments)
+    }
+}
 
-module.exports = Emitter || require('events').EventEmitter
+module.exports = Emitter

File diff suppressed because it is too large
+ 0 - 30
test/vue.test-cov.js


Some files were not shown because too many files changed in this diff