Skip to content

Instantly share code, notes, and snippets.

@mildfuzz
Created March 5, 2015 15:40
Show Gist options
  • Select an option

  • Save mildfuzz/a673e2820bf0c5f62306 to your computer and use it in GitHub Desktop.

Select an option

Save mildfuzz/a673e2820bf0c5f62306 to your computer and use it in GitHub Desktop.
Maker Client Lib

Maker Lib

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);
});

Args object

All methods accept a single object as a parameter. The args object is parsed against a scheme to check type.

Args Schema

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.

Object Methods

make.addEventListener (function)

Add a method to the callback chain for an event

make.removeEventListener (function optional)

Remove a function from the callback chain for an event If empty, removes all functions from callback chain for event

make.save (args);

// configuration data for DigitalMake
var args = {
    title: 'My Super Make'
};

make.save(args);

Public Attributes

make.el

Container ID, as a string without hash. DMK Partners can choose their own DOM query method to locate and populate container.

Available Events

These events can be used with make.addEventListener and make.removeEventListener

  • save
  • fail

For Review

Possible Future Methods

make.update

make.getData

Publish Getter and Setter

Achievement Getter and Setter

Endpoint Getter

For manual API interactions

Auth Setter

Is Remixable Getter

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