Last active
November 18, 2015 05:07
-
-
Save anthonyvscode/b92896fe1c3474ea6f6f to your computer and use it in GitHub Desktop.
KnockoutJS autosize.js (http://www.jacklmoore.com/autosize/) custom binding handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD. Register as an anonymous module. | |
define(["knockout", "autosize"], factory); | |
} else { | |
// Browser globals | |
factory(ko, autosize); | |
} | |
}(this, function (ko, autosize) { | |
ko.bindingHandlers.autosize = { | |
init: function (element, valueAccessor) { | |
var enabled = ko.unwrap(valueAccessor()); | |
if (enabled === true) { | |
autosize(element); | |
} | |
} | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: