|
@@ -4,6 +4,11 @@ var config = require('./config'),
|
|
|
makeHash = utils.hash,
|
|
makeHash = utils.hash,
|
|
|
assetTypes = ['directive', 'filter', 'partial', 'transition', 'component']
|
|
assetTypes = ['directive', 'filter', 'partial', 'transition', 'component']
|
|
|
|
|
|
|
|
|
|
+// require these so Browserify can catch them
|
|
|
|
|
+// so they can be used in Vue.require
|
|
|
|
|
+require('./observer')
|
|
|
|
|
+require('./transition')
|
|
|
|
|
+
|
|
|
ViewModel.options = config.globalAssets = {
|
|
ViewModel.options = config.globalAssets = {
|
|
|
directives : require('./directives'),
|
|
directives : require('./directives'),
|
|
|
filters : require('./filters'),
|
|
filters : require('./filters'),
|
|
@@ -48,13 +53,6 @@ ViewModel.config = function (opts, val) {
|
|
|
return this
|
|
return this
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * Expose internal modules for plugins
|
|
|
|
|
- */
|
|
|
|
|
-ViewModel.require = function (path) {
|
|
|
|
|
- return require('./' + path)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Expose an interface for plugins
|
|
* Expose an interface for plugins
|
|
|
*/
|
|
*/
|
|
@@ -69,13 +67,21 @@ ViewModel.use = function (plugin) {
|
|
|
|
|
|
|
|
// additional parameters
|
|
// additional parameters
|
|
|
var args = [].slice.call(arguments, 1)
|
|
var args = [].slice.call(arguments, 1)
|
|
|
- args.unshift(ViewModel)
|
|
|
|
|
|
|
+ args.unshift(this)
|
|
|
|
|
|
|
|
if (typeof plugin.install === 'function') {
|
|
if (typeof plugin.install === 'function') {
|
|
|
plugin.install.apply(plugin, args)
|
|
plugin.install.apply(plugin, args)
|
|
|
} else {
|
|
} else {
|
|
|
plugin.apply(null, args)
|
|
plugin.apply(null, args)
|
|
|
}
|
|
}
|
|
|
|
|
+ return this
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Expose internal modules for plugins
|
|
|
|
|
+ */
|
|
|
|
|
+ViewModel.require = function (path) {
|
|
|
|
|
+ return require('./' + path)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ViewModel.extend = extend
|
|
ViewModel.extend = extend
|
|
@@ -118,8 +124,8 @@ function extend (options) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// allow extended VM to be further extended
|
|
// allow extended VM to be further extended
|
|
|
- ExtendedVM.extend = extend
|
|
|
|
|
- ExtendedVM.super = ParentVM
|
|
|
|
|
|
|
+ ExtendedVM.extend = extend
|
|
|
|
|
+ ExtendedVM.super = ParentVM
|
|
|
ExtendedVM.options = options
|
|
ExtendedVM.options = options
|
|
|
|
|
|
|
|
// allow extended VM to add its own assets
|
|
// allow extended VM to add its own assets
|
|
@@ -127,6 +133,10 @@ function extend (options) {
|
|
|
ExtendedVM[type] = ViewModel[type]
|
|
ExtendedVM[type] = ViewModel[type]
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ // allow extended VM to use plugins
|
|
|
|
|
+ ExtendedVM.use = ViewModel.use
|
|
|
|
|
+ ExtendedVM.require = ViewModel.require
|
|
|
|
|
+
|
|
|
return ExtendedVM
|
|
return ExtendedVM
|
|
|
}
|
|
}
|
|
|
|
|
|