Create a gist now

Instantly share code, notes, and snippets.

Embed
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }
ko.utils.arrayIndexOf = function (array, item) { /* .. */ }
ko.utils.arrayMap = function (array, mapping) { /* .. */ }
ko.utils.arrayPushAll = function (array, valuesToPush) { /* .. */ }
ko.utils.arrayRemoveItem = function (array, itemToRemove) { /* .. */ }
ko.utils.cloneNodes = function (nodesArray, shouldCleanNodes) { /* .. */ }
ko.utils.compareArrays = function compareArrays(oldArray, newArray, dontLimitMoves) { /* .. */ }
ko.utils.domNodeIsAttachedToDocument = function (node) { /* .. */ }
ko.utils.domNodeIsContainedBy = function (node, containedByNode) { /* .. */ }
ko.utils.emptyDomNode = function (domNode) { /* .. */ }
ko.utils.ensureSelectElementIsRenderedCorrectly = function (selectElement) { /* .. */ }
ko.utils.extend = function (target, source) { /* .. */ }
ko.utils.forceRefresh = function (node) { /* .. */ }
ko.utils.getFormFields = function (form, fieldName) { /* .. */ }
ko.utils.makeArray = function (arrayLikeObject) { /* .. */ }
ko.utils.moveCleanedNodesToContainerElement = function (nodes) { /* .. */ }
ko.utils.parseHtmlFragment = function (html) { /* .. */ }
ko.utils.parseJson = function (jsonString) { /* .. */ }
ko.utils.peekObservable = function (value) { /* .. */ }
ko.utils.postJson = function (urlOrForm, data, options) { /* .. */ }
ko.utils.range = function (min, max) { /* .. */ }
ko.utils.registerEventHandler = function (element, eventType, handler) { /* .. */ }
ko.utils.replaceDomNodes = function (nodeToReplaceOrNodeArray, newNodesArray) { /* .. */ }
ko.utils.setDomNodeChildren = function (domNode, childNodes) { /* .. */ }
ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) { /* .. */ }
ko.utils.setElementName = function (element, name) { /* .. */ }
ko.utils.setHtml = function (node, html) { /* .. */ }
ko.utils.setOptionNodeSelectionState = function (optionNode, isSelected) { /* .. */ }
ko.utils.setTextContent = function (element, textContent) { /* .. */ }
ko.utils.stringStartsWith = function (string, startsWith) { /* .. */ }
ko.utils.stringTokenize = function (string, delimiter) { /* .. */ }
ko.utils.stringTrim = function (string) { /* .. */ }
ko.utils.stringifyJson = function (data, replacer, space) { // replacer and space are optional /* .. */ }
ko.utils.tagNameLower = function (element) { /* .. */ }
ko.utils.toggleDomNodeCssClass = function (node, classNames, shouldHaveClass) { /* .. */ }
ko.utils.triggerEvent = function (element, eventType) { /* .. */ }
ko.utils.unwrapObservable = function (value) { /* .. */ }
@greeze

This comment has been minimized.

Show comment
Hide comment
@greeze

greeze Feb 15, 2013

THANK YOU!

greeze commented Feb 15, 2013

THANK YOU!

@enzoaeneas

This comment has been minimized.

Show comment
Hide comment
@enzoaeneas

enzoaeneas Feb 23, 2013

sweet!

sweet!

@emayk

This comment has been minimized.

Show comment
Hide comment
@emayk

emayk Jun 17, 2013

nice , thanks a lot

emayk commented Jun 17, 2013

nice , thanks a lot

@hyle

This comment has been minimized.

Show comment
Hide comment
@hyle

hyle Jul 6, 2013

for KnockoutJS 2.3.0: https://gist.github.com/hyle/5939707

Owner

hyle commented Jul 6, 2013

for KnockoutJS 2.3.0: https://gist.github.com/hyle/5939707

@hyle

This comment has been minimized.

Show comment
Hide comment
@hyle

hyle Oct 25, 2013

for KnockoutJS 3.0.0: https://gist.github.com/hyle/7154437

Owner

hyle commented Oct 25, 2013

for KnockoutJS 3.0.0: https://gist.github.com/hyle/7154437

@hyle

This comment has been minimized.

Show comment
Hide comment
@hyle

hyle Mar 5, 2014

for KnockoutJS 3.1.0: https://gist.github.com/hyle/9363349

Owner

hyle commented Mar 5, 2014

for KnockoutJS 3.1.0: https://gist.github.com/hyle/9363349

@xiaojian520

This comment has been minimized.

Show comment
Hide comment
@xiaojian520

xiaojian520 Mar 12, 2014

谢谢

谢谢

@hyle

This comment has been minimized.

Show comment
Hide comment
@hyle

hyle Feb 19, 2015

@hyle

This comment has been minimized.

Show comment
Hide comment
@hyle

hyle Feb 7, 2016

for KnockoutJS 3.4.0 / 3.4.1 / 3.4.2: https://gist.github.com/hyle/8840a083bcd1325a59ca

Owner

hyle commented Feb 7, 2016

for KnockoutJS 3.4.0 / 3.4.1 / 3.4.2: https://gist.github.com/hyle/8840a083bcd1325a59ca

@Arthur-Z

This comment has been minimized.

Show comment
Hide comment
@Arthur-Z

Arthur-Z Nov 10, 2016

非常感谢!!!但能否继续提供一些使用示例或文档?

Arthur-Z commented Nov 10, 2016

非常感谢!!!但能否继续提供一些使用示例或文档?

@alfredrumss

This comment has been minimized.

Show comment
Hide comment
@alfredrumss

alfredrumss Jan 17, 2018

Thank you so much!

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment