Module returns abstracted constructor function. This should be instantiated by the DMK Container, resulting object passed into the DMK contructor.
var make = Make(token, container);
require(['path/to/dmk/main.js'], function(dmk){
dmk.init(make);
});All methods accept a single object as a parameter. The args object is parsed against a scheme to check type.
argsSchema = {
data: Object,
pass: Function,
fail: Function
}Each key in the args object is checked for existence against the schema, then its value is type checked.
args.data is persisted, but can be overwritten with each method call. This is useful as developers can pass a reference to a UserData object which is automatically persisted through JavaScript object reference. Callbacks do not persist. If you would like to have a callback persist, use event listener methods.
Add a method to the callback chain for an event
Remove a function from the callback chain for an event If empty, removes all functions from callback chain for event
// configuration data for DigitalMake
var args = {
title: 'My Super Make'
};
make.save(args);Container ID, as a string without hash. DMK Partners can choose their own DOM query method to locate and populate container.
These events can be used with make.addEventListener and make.removeEventListener
- save
- fail
For manual API interactions