Futures.par(Arr.map(urls, loadF)).get(function (result) { const parts = Arr.partition(result, function (r) { return r.isValue(); }); if (parts.fail.length > 0) { failure(parts.fail.map(unbox)); } else { success(parts.pass.map(unbox)); } });
const add = (id: string, addOn: (editor: Editor, url: string) => any, dependencies?) => { items.push(addOn); lookup[id] = { instance: addOn, dependencies }; const result = Arr.partition(_listeners, function (listener) { return listener.name === id; }); _listeners = result.fail; each(result.pass, function (listener) { listener.callback(); }); return addOn; };
const renderComponents = (_data, state) => { // default group is 'end' const footerButtons = state.map((s) => s.footerButtons).getOr([ ]); const buttonGroups = Arr.partition(footerButtons, (button) => button.align === 'start'); const makeGroup = (edge, buttons): SketchSpec => Container.sketch({ dom: { tag: 'div', classes: [ `tox-dialog__footer-${edge}` ] }, components: Arr.map(buttons, (button) => button.memento.asSpec()) }); const startButtons = makeGroup('start', buttonGroups.pass); const endButtons = makeGroup('end', buttonGroups.fail); return [ startButtons, endButtons ]; };
* }); * * // Register plugin using the add method * tinymce.PluginManager.add('test', tinymce.plugins.TestPlugin); * * // Initialize TinyMCE * tinymce.init({ * ... * plugins: '-test' // Init the plugin but don't try to load it * }); */ add (id, addOn, dependencies) { this.items.push(addOn); this.lookup[id] = { instance: addOn, dependencies }; const result = Arr.partition(this._listeners, function (listener) { return listener.name === id; }); this._listeners = result.fail; each(result.pass, function (listener) { listener.callback(); }); return addOn; }, remove (name) { delete this.urls[name]; delete this.lookup[name]; },