Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
unregisterModal(name) {
const id = buildName(pilet, name);
context.unregisterModal(id);
},
};
registerTile(name, arg, preferences?) {
if (typeof name !== 'string') {
preferences = arg;
arg = name;
name = next++;
}
const id = buildName(pilet, name);
context.registerTile(id, {
pilet,
component: withApi(context.converters, arg, api, 'tile'),
preferences: getPreferences(defaultPreferences, preferences),
});
},
unregisterTile(name) {
unregisterMenu(name) {
const id = buildName(pilet, name);
context.unregisterMenuItem(id);
},
};
createConnector(resolver) {
const id = buildName(target.name, feeds++);
const options = createFeedOptions(id, resolver);
const invalidate = () => context.createFeed(options.id);
if (options.immediately) {
context.loadFeed(options);
} else {
invalidate();
}
const connect = (component => withFeed(component, options) as any) as FeedConnector;
connect.invalidate = invalidate;
return connect;
},
};
showModal(name, options) {
const dialog = {
name: buildName(pilet, name),
alternative: name,
options,
close() {
context.closeModal(dialog);
},
};
context.openModal(dialog);
return dialog.close;
},
registerModal(name, arg, defaults) {
unregisterTile(name) {
const id = buildName(pilet, name);
context.unregisterTile(id);
},
};
unregisterSearchProvider(name) {
const id = buildName(pilet, name);
context.unregisterSearchProvider(id);
},
};
registerMenu(name, arg, settings?) {
if (typeof name !== 'string') {
settings = arg;
arg = name;
name = next++;
}
const id = buildName(pilet, name);
context.registerMenuItem(id, {
pilet,
component: withApi(context.converters, arg, api, 'menu'),
settings: getSettings(defaultSettings, settings),
});
},
unregisterMenu(name) {
registerModal(name, arg, defaults) {
const id = buildName(pilet, name);
context.registerModal(id, {
pilet,
name,
component: withApi(context.converters, arg, api, 'modal'),
defaults,
});
},
unregisterModal(name) {
createState(options) {
const actions = {};
const id = buildName(target.name, containers++);
const cb = dispatch => context.replaceState(id, dispatch);
context.createState(id, options.state);
Object.keys(options.actions).forEach(key => {
const action = options.actions[key];
actions[key] = (...args) => action.call(api, cb, ...args);
});
return component => withPiletState(component, id, actions) as any;
},
};