Tips & tricks

A collection of tips and tricks when developing and testing dizmos.

1. Reload a dizmo

reload item
reload item

Note: You can only reload a dizmo while in the development mode.

2. Tree Navigation

See possible nodes in storage tree

dizmo.publicStorage.getProperty("",{nodes: true})

See possible attributes

dizmo.getAttribute("settings") // returns object
dizmo.getAttribute("geometry")

3. Find a dizmo

var stickyNotes = viewer.getDizmos().filter(function(x){return x.getBundle().identifier.indexOf("stickynotes")>-1})
stickyNotes[0].focus();

4. Instantiate a new dizmo via bundleID

var bundleTimer = viewer.getBundleById("com.dizmo.timer") // creates bundle object
bundleTimer.instantiateDizmo({},{},{},function(){console.log("done")})  // attributes, publicStorage, privateStorage, callback

5. Interate over all dizmos with .map()

viewer.getDizmos()[0].publicStorage.getProperty("stdout");
viewer.getDizmos().map(function(x){return x.publicStorage.getProperty("stdout");})

6. Setting a new dizmo icon

Put additional images into the root folder of the dizmo or inside the assets folder. Then set the new icon via:

dizmo.setAttribute("settings/iconimage","Icon2.svg");

7. Recursive subscriptions

dizmo.publicStorage.subscribeToProperty("stdout",function(e){console.log(e);},{recursive:true},function(){console.log("subscription to property established")})
dizmo.publicStorage.setProperty("stdout/subStdOut","newValue")