Skip to content
Sheng Zhao edited this page Jul 13, 2015 · 9 revisions

##General helpers

  • Knot.ready(callback): the call back will be called when initialize of knot.js is finished, if it's already finished, the callback will be called immediately.

  • Knot.clear(node): clear the bindings for the node and it's descendants. If node is not passed in, it clear all of the bindings on the page.

  • Knot.getErrorStatusInformation(rootNode): get the error status information of the elements in rootNode. if no rootNode is specified, it returns all of the error status in current page.

  • Knot.getDataContext(htmlElement): get the current data context from the HTML element.

  • Knot.monitorObject(object, path, callback): monitor the object change.

  • Knot.stopMonitoringObject(object, path, callback): stop monitoring the object change.

  • Knot.getPropertiesChangeRecords(object) get the changed properties of since the object is monitored or clearPropertiesChangeRecords is called last time. This function only returns the changed properties the monitored somewhere.

  • Knot.clearPropertiesChangeRecords(object) clear the change records for properties.

  • Knot.getKnotVariant(name): get a knot variant. for more information, please refer this link: https://github.com/alexzhaosheng/knot.js/wiki/Knot-Variant

  • Knot.setKnotVariant(name, value): set a knot variant. for more information, please refer this link: https://github.com/alexzhaosheng/knot.js/wiki/Knot-Variant

##Advanced Helpers

  • Knot.Advanced.createFromTemplate(templateId, data, owner): create the element from template. Note you need to bind your data to the created element by calling Knot.Advanced.setDataContext

  • Knot.Advanced.setDataContext(node, data): bind the data to node.

  • Knot.Advanced.registerComponent(name, factoryMethod): register a component, and pass the factory method to knot.js

  • Knot.Advanced.getComponentObject(node): get the object of the component on the node

  • Knot.Advanced.loadPrivatePackage(url): load the private CBS package

  • Knot.Advanced.getValueOnPath(data, path): get value on the path of the data

  • Knot.Advanced.registerNamedGlobalSymbol(name, value): register a global symbol with name, the registered symbol can be accessed with __knot_global.[symbol name]

  • Knot.Advanced.registerAPProvider(provider): register a Access Point Provider to system to add new Access Points support

  • Knot.Advanced.registerLogger(logger): register a logger

  • Knot.Advanced.registerDebugger(debugger) register a debugger

Clone this wiki locally