ampersand-view
Advanced tools
Comparing version 9.0.2 to 10.0.0
@@ -5,16 +5,16 @@ /*$AMPERSAND_VERSION*/ | ||
var domify = require('domify'); | ||
var uniqueId = require("lodash.uniqueid"); | ||
var pick = require("lodash.pick"); | ||
var assign = require("lodash.assign"); | ||
var forEach = require("lodash.foreach"); | ||
var result = require("lodash.result"); | ||
var last = require("lodash.last"); | ||
var isString = require("lodash.isstring"); | ||
var bind = require("lodash.bind"); | ||
var flatten = require("lodash.flatten"); | ||
var invoke = require("lodash.invoke"); | ||
var uniqueId = require("lodash/uniqueId"); | ||
var pick = require("lodash/pick"); | ||
var assign = require("lodash/assign"); | ||
var forEach = require("lodash/forEach"); | ||
var result = require("lodash/result"); | ||
var last = require("lodash/last"); | ||
var isString = require("lodash/isString"); | ||
var bind = require("lodash/bind"); | ||
var flatten = require("lodash/flatten"); | ||
var invokeMap = require("lodash/invokeMap"); | ||
var events = require('events-mixin'); | ||
var matches = require('matches-selector'); | ||
var bindings = require('ampersand-dom-bindings'); | ||
var getPath = require('lodash.get'); | ||
var getPath = require('lodash/get'); | ||
@@ -214,3 +214,3 @@ function View(attrs) { | ||
// Storage for our subviews. | ||
this._subviews || (this._subviews = []); | ||
this._subviews = this._subviews || []; | ||
this._subviews.push(view); | ||
@@ -432,3 +432,3 @@ // set the parent reference if it has not been set | ||
if (!this.bindingsSet) return; | ||
if (this._subviews) invoke(flatten(this._subviews), 'remove'); | ||
if (this._subviews) invokeMap(flatten(this._subviews), 'remove'); | ||
this.stopListening(); | ||
@@ -435,0 +435,0 @@ // TODO: Not sure if this is actually necessary. |
{ | ||
"name": "ampersand-view", | ||
"description": "A smart base view for Backbone apps, to make it easy to bind collections and properties to the DOM.", | ||
"version": "9.0.2", | ||
"version": "10.0.0", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -16,3 +16,3 @@ "browser": "./ampersand-view.js", | ||
"ampersand-dom-bindings": "^3.5.0", | ||
"ampersand-state": "^4.5.2", | ||
"ampersand-state": "^5.0.1", | ||
"ampersand-version": "^1.0.2", | ||
@@ -22,13 +22,3 @@ "component-classes": "^1.2.4", | ||
"events-mixin": "^1.2.0", | ||
"lodash.assign": "^3.0.0", | ||
"lodash.bind": "^3.1.0", | ||
"lodash.flatten": "^3.0.2", | ||
"lodash.foreach": "^3.0.2", | ||
"lodash.get": "^3.1.0", | ||
"lodash.invoke": "^3.1.0", | ||
"lodash.isstring": "^3.0.1", | ||
"lodash.last": "^3.0.0", | ||
"lodash.pick": "^3.1.0", | ||
"lodash.result": "^3.0.0", | ||
"lodash.uniqueid": "^3.0.0", | ||
"lodash": "^4.11.1", | ||
"matches-selector": "^1.0.0" | ||
@@ -40,4 +30,3 @@ }, | ||
"browserify": "^9.0.4", | ||
"jsdom": "^4.1.0", | ||
"phantomjs": "^1.9.7-15", | ||
"jsdom": "^8.3.1", | ||
"precommit-hook": "^2.0.1", | ||
@@ -44,0 +33,0 @@ "run-browser": "^2.0.2", |
@@ -19,3 +19,3 @@ # ampersand-view | ||
## Install | ||
## install | ||
@@ -502,4 +502,10 @@ ``` | ||
* viewInstance {Object} Any object with a "remove" method, typically an instantiated view. But doesn't have to be, it can be anything with a remove method. The remove method doesn't have to actually remove itself from the DOM (since the parent view is being removed anyway), it is generally just used for unregistering any handler that it set up. | ||
* viewInstance {Object} Any object with a "remove" method, typically an instantiated view. But doesn't have to be, it can be anything with a remove method. The remove method doesn't have to actually remove itself from the DOM (since the parent view is being removed anyway), it is generally just used for unregistering any handler that the subview sets up. | ||
This method will: | ||
1. store a reference to the subview for cleanup when `remove()` is called. | ||
2. add a reference to itself at `subview.parent` | ||
3. return the subview | ||
### renderSubview `view.renderSubview(viewInstance, containerEl)` | ||
@@ -515,5 +521,5 @@ | ||
1. fetch your container (if you gave it a selector string) | ||
2. register your subview so it gets cleaned up if parent is removed and so `view.parent` will be available when your subview's `render` method gets called | ||
2. register your subview so it gets cleaned up if parent is removed and so `this.parent` will be available when your subview's `render` method gets called | ||
3. call the subview's `render()` method | ||
4. append it to the container | ||
4. append it to the container (or the parent view's el if no container given) | ||
5. return the subview | ||
@@ -606,3 +612,6 @@ | ||
## Changelog | ||
## changelog | ||
- 10.0.0 | ||
- bump to `ampersand-state` 5.x | ||
- reduce bundle size via `lodash` upgrade and require methodology | ||
- 9.0.0 | ||
@@ -624,3 +633,3 @@ - support render-remove-render view instance lifecycle. previously bindings were trashed for good on remove() | ||
## Test coverage? | ||
## test coverage? | ||
@@ -632,3 +641,3 @@ Why yes! So glad you asked :) | ||
## Like this? | ||
## like this? | ||
@@ -635,0 +644,0 @@ Follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on twitter and check out my recently released book: [human javascript](http://humanjavascript.com) which includes a full explanation of this as well as a whole bunch of other stuff for building awesome single page apps. |
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
84129
9
9
13
1572
645
+ Addedlodash@^4.11.1
+ Addedampersand-events@2.0.2(transitive)
+ Addedampersand-state@5.0.3(transitive)
- Removedlodash.assign@^3.0.0
- Removedlodash.bind@^3.1.0
- Removedlodash.flatten@^3.0.2
- Removedlodash.foreach@^3.0.2
- Removedlodash.get@^3.1.0
- Removedlodash.invoke@^3.1.0
- Removedlodash.isstring@^3.0.1
- Removedlodash.last@^3.0.0
- Removedlodash.pick@^3.1.0
- Removedlodash.result@^3.0.0
- Removedlodash.uniqueid@^3.0.0
- Removedampersand-state@4.9.1(transitive)
- Removedlodash._arraymap@3.0.0(transitive)
- Removedlodash._baseuniq@3.0.3(transitive)
- Removedlodash._basevalues@3.0.0(transitive)
- Removedlodash.escape@3.2.0(transitive)
- Removedlodash.flatten@3.0.2(transitive)
- Removedlodash.forown@3.0.2(transitive)
- Removedlodash.get@3.7.0(transitive)
- Removedlodash.has@3.2.1(transitive)
- Removedlodash.includes@3.1.3(transitive)
- Removedlodash.isdate@3.0.3(transitive)
- Removedlodash.isequal@3.0.4(transitive)
- Removedlodash.isobject@3.0.2(transitive)
- Removedlodash.last@3.0.0(transitive)
- Removedlodash.omit@3.1.0(transitive)
- Removedlodash.result@3.1.2(transitive)
- Removedlodash.union@3.1.0(transitive)
Updatedampersand-state@^5.0.1