(object:RegisterableObject)
| 166 | * @param {RegisterableObject} object - object to be registered. |
| 167 | */ |
| 168 | export function registerObject(object:RegisterableObject):void{ |
| 169 | if (!object.getId) { |
| 170 | __trace('Cannot register object without getId method.','warn'); |
| 171 | return; |
| 172 | } |
| 173 | if (!Runtime.hasObject(object.getId())) { |
| 174 | _registeredObjects[object.getId()] = object; |
| 175 | __pchannel('Runtime:RegisterObject', { |
| 176 | 'id': object.getId(), |
| 177 | 'data': object.serialize() |
| 178 | }); |
| 179 | __schannel("object::(" + object.getId() + ")", (payload:any) => { |
| 180 | if (payload.hasOwnProperty('type') && |
| 181 | payload.type === 'event') { |
| 182 | _dispatchEvent(object.getId(), payload.event, payload.data); |
| 183 | } |
| 184 | }); |
| 185 | objCount++; |
| 186 | return; |
| 187 | } else { |
| 188 | __trace('Attempted to re-register object or id collision @ ' + |
| 189 | object.getId(), 'warn'); |
| 190 | return; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * De-Registers an object from the runtime. This not only removes the object |
nothing calls this directly
no test coverage detected