diff --git a/lib/index.js b/lib/index.js index 3d0e8e1..9ee5d97 100755 --- a/lib/index.js +++ b/lib/index.js @@ -2,7 +2,7 @@ import Agent from './agent' import Animator from './animator' import Queue from './queue' import Balloon from './balloon' -import { load, ready, soundsReady } from './load' +import { load, loadExistingAgent, ready, soundsReady } from './load' const clippy = { Agent, @@ -11,7 +11,8 @@ const clippy = { Balloon, load, ready, - soundsReady + soundsReady, + loadExistingAgent, } export default clippy @@ -19,5 +20,3 @@ export default clippy if (typeof window !== 'undefined') { window.clippy = clippy } - - diff --git a/lib/load.js b/lib/load.js index 35a63c8..b52682d 100755 --- a/lib/load.js +++ b/lib/load.js @@ -24,6 +24,7 @@ export class load { // wrapper to the success callback let cb = function () { let a = new Agent(path, data, sounds); + load._agents[name] = a successCb(a); }; @@ -105,6 +106,7 @@ export class load { load._maps = {}; load._sounds = {}; load._data = {}; +load._agents = {} export function ready (name, data) { let dfd = load._getAgentDfd(name); @@ -119,3 +121,7 @@ export function soundsReady (name, data) { dfd.resolve(data); } + +export function loadExistingAgent (name) { + return load._agents[name] +}