8000
We read every piece of feedback, and take your input very seriously.
1 parent 4bc1243 commit b784efeCopy full SHA for b784efe
src/viewmodel.js
@@ -16,14 +16,23 @@ var Compiler = require('./compiler'),
16
* and a few reserved methods
17
*/
18
function ViewModel (options) {
19
- // just compile. options are passed directly to compiler
+ // compile if options passed, if false return. options are passed directly to compiler
20
+ if( options === false ) return;
21
new Compiler(this, options)
22
}
23
24
// All VM prototype methods are inenumerable
25
// so it can be stringified/looped through as raw data
26
var VMProto = ViewModel.prototype
27
28
+/**
29
+ * init allows config compilation after instantiation
30
+ * var a = new Vue(false); a.init( config );
31
+ */
32
+def(VMProto, 'init', function (options) {
33
+ new Compiler( this, options )
34
+})
35
+
36
/**
37
* Convenience function to get a value from
38
* a keypath
@@ -177,4 +186,4 @@ function query (el) {
177
186
: el
178
187
179
188
180
-module.exports = ViewModel
189
+module.exports = ViewModel